Files

17 lines
469 B
TypeScript
Raw Permalink Normal View History

import { createYoga } from 'graphql-yoga'
import { makeExecutableSchema } from '@graphql-tools/schema'
import { typeDefs } from '@/lib/graphql/schema'
import { resolvers } from '@/lib/graphql/resolvers'
const schema = makeExecutableSchema({ typeDefs, resolvers })
const yoga = createYoga({
schema,
graphqlEndpoint: '/api/graphql',
fetchAPI: { Response, Request, ReadableStream },
})
export const GET = yoga
export const POST = yoga
export const OPTIONS = yoga