add pothos
This commit is contained in:
parent
7954843448
commit
e06dc1ec94
4 changed files with 19 additions and 16 deletions
BIN
bun.lockb
BIN
bun.lockb
Binary file not shown.
|
|
@ -48,6 +48,7 @@
|
|||
"vitest": "^2.0.4"
|
||||
},
|
||||
"dependencies": {
|
||||
"@pothos/core": "^4.3.0",
|
||||
"@tailwindcss/typography": "^0.5.15",
|
||||
"graphql": "^16.9.0",
|
||||
"graphql-yoga": "^5.10.4",
|
||||
|
|
|
|||
14
src/lib/pothos/index.ts
Normal file
14
src/lib/pothos/index.ts
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
import SchemaBuilder from '@pothos/core';
|
||||
|
||||
export const builder = new SchemaBuilder({});
|
||||
|
||||
builder.queryType({
|
||||
fields: (t) => ({
|
||||
version: t.string({
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
resolve: (parent, args, context) => '1.0.0-alpha'
|
||||
})
|
||||
})
|
||||
});
|
||||
|
||||
export const Schema = builder.toSchema();
|
||||
|
|
@ -1,22 +1,10 @@
|
|||
import { Schema } from '$lib/pothos';
|
||||
import type { RequestEvent } from '@sveltejs/kit';
|
||||
import { createSchema, createYoga } from 'graphql-yoga';
|
||||
import { createYoga } from 'graphql-yoga';
|
||||
|
||||
export const Yoga = createYoga<RequestEvent>({
|
||||
schema: createSchema({
|
||||
typeDefs: `
|
||||
type Query {
|
||||
hello: String
|
||||
}
|
||||
`,
|
||||
resolvers: {
|
||||
Query: {
|
||||
hello: () => 'SvelteKit - GraphQL Yoga'
|
||||
}
|
||||
}
|
||||
}),
|
||||
// Needed to be defined explicitly because our endpoint lives at a different path other than `/graphql`
|
||||
schema: Schema,
|
||||
graphqlEndpoint: '/api/graphql',
|
||||
|
||||
// Needed to let Yoga use sveltekit's Response object
|
||||
// Let Yoga use sveltekit's Response object
|
||||
fetchAPI: { Response }
|
||||
});
|
||||
Loading…
Add table
Reference in a new issue