22 lines
408 B
TypeScript
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)
|
|
}
|