graphql
This commit is contained in:
parent
e6291ff475
commit
6d0f119c41
27
README.md
27
README.md
|
@ -36,3 +36,30 @@ npm run build
|
|||
You can preview the production build with `npm run preview`.
|
||||
|
||||
> To deploy your app, you may need to install an [adapter](https://kit.svelte.dev/docs/adapters) for your target environment.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
SERVER (WEB SERVER )
|
||||
|
||||
|
||||
client -> GET -> server (html/css/js)
|
||||
|
||||
dist (DATA) 300kb
|
||||
|
||||
CACHE -> html/css/js
|
||||
|
||||
COOKIES -> EVENTS ( login/password, last session)
|
||||
|
||||
LocalStorage --> ( key-object database ) (MORE DATA > 60 days)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
22
codegen.ts
Normal file
22
codegen.ts
Normal file
|
@ -0,0 +1,22 @@
|
|||
import { CodegenConfig } from '@graphql-codegen/cli';
|
||||
|
||||
const config: CodegenConfig = {
|
||||
schema: 'http://localhost:1337/graphql',
|
||||
// this assumes that all your source files are in a top-level `src/` directory - you might need to adjust this to your file structure
|
||||
documents: ['src/**/*.{ts,tsx}'],
|
||||
generates: {
|
||||
'./src/__generated__/': {
|
||||
preset: 'client',
|
||||
plugins: [
|
||||
"typescript",
|
||||
"typescript-operations"
|
||||
],
|
||||
presetConfig: {
|
||||
gqlTagName: 'gql',
|
||||
}
|
||||
}
|
||||
},
|
||||
ignoreNoDocuments: true,
|
||||
};
|
||||
|
||||
export default config;
|
4714
package-lock.json
generated
4714
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
|
@ -16,6 +16,7 @@
|
|||
"test:unit": "vitest"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@graphql-codegen/cli": "^5.0.3",
|
||||
"@playwright/test": "^1.28.1",
|
||||
"@sveltejs/adapter-auto": "^3.0.0",
|
||||
"@sveltejs/kit": "^2.0.0",
|
||||
|
@ -32,7 +33,7 @@
|
|||
"svelte": "^5.0.0-next.1",
|
||||
"svelte-check": "^4.0.0",
|
||||
"tailwindcss": "^3.4.13",
|
||||
"typescript": "^5.0.0",
|
||||
"typescript": "^5.6.3",
|
||||
"vite": "^5.0.3",
|
||||
"vitest": "^2.0.0"
|
||||
},
|
||||
|
@ -41,6 +42,7 @@
|
|||
"@apollo/client": "^3.11.8",
|
||||
"@types/uuid": "^10.0.0",
|
||||
"axios": "^1.7.7",
|
||||
"graphql": "^16.9.0",
|
||||
"graphql-request": "^7.1.0",
|
||||
"svelte-icons": "^2.1.0",
|
||||
"svelte-icons-pack": "^3.1.3"
|
||||
|
|
10
src/routes/+layout.server.ts
Normal file
10
src/routes/+layout.server.ts
Normal file
|
@ -0,0 +1,10 @@
|
|||
import type { LayoutServerLoad } from "./$types";
|
||||
|
||||
export const load = (async ({ cookies }) => {
|
||||
|
||||
let user = cookies.get("hresssdfs")
|
||||
|
||||
return {
|
||||
"islogin":user==null?false: true
|
||||
}
|
||||
}) satisfies LayoutServerLoad;
|
|
@ -1,5 +1,9 @@
|
|||
<script>
|
||||
import "../app.css";
|
||||
</script>
|
||||
|
||||
export let data;
|
||||
</script>
|
||||
{
|
||||
data.islogin?"в системе":"нужно логиниться"
|
||||
}
|
||||
<slot></slot>
|
||||
|
|
6
src/routes/+page.server.ts
Normal file
6
src/routes/+page.server.ts
Normal file
|
@ -0,0 +1,6 @@
|
|||
import type { PageServerLoad } from "./$types";
|
||||
|
||||
export const load = (({ }) => {
|
||||
|
||||
|
||||
}) satisfies PageServerLoad;
|
|
@ -1,2 +1,3 @@
|
|||
<h1 class= "">Welcome to SvelteKit</h1>
|
||||
<h1 class= " text-4xl">Welcome to SvelteKit</h1>
|
||||
<p>Visit <a href="https://kit.svelte.dev">kit.svelte.dev</a> to read the documentation</p>
|
||||
|
||||
|
|
20
src/routes/api/+server.ts
Normal file
20
src/routes/api/+server.ts
Normal file
|
@ -0,0 +1,20 @@
|
|||
|
||||
export const GET = (({cookies}) => {
|
||||
|
||||
return Response.json({"test":"test"}) ;
|
||||
})
|
||||
|
||||
export const POST = (() => {
|
||||
|
||||
return Response.json({"test":"test"}) ;
|
||||
})
|
||||
export const PUT = (() => {
|
||||
|
||||
return Response.json({"test":"test"}) ;
|
||||
})
|
||||
export const DELETE = (() => {
|
||||
|
||||
return Response.json({"test":"test"}) ;
|
||||
})
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user