manifold/web/pages/api/graphql/index.ts
joy_void_joy efab3de172 graphql: Add mocked graphql endpoint
Add a graphql endpoint at /api/graphql
2022-07-20 18:15:53 +02:00

22 lines
408 B
TypeScript

import type { NextApiRequest, NextApiResponse } from 'next'
import { apolloServer } from 'web/lib/api/graphql'
const startServer = apolloServer.start()
export const config = {
api: {
bodyParser: false,
},
}
export default async function handler(
req: NextApiRequest,
res: NextApiResponse
) {
await startServer
await apolloServer.createHandler({
path: '/api/graphql',
})(req, res)
}