react-code-dataset / next.js /examples /api-routes-apollo-server-and-client-auth /pages /api /graphql.ts
Download next.js/examples/api-routes-apollo-server-and-client-auth/pages/api/graphql.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 480 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/examples/api-routes-apollo-server-and-client-auth/pages/api/graphql.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/next.js/examples/api-routes-apollo-server-and-client-auth/pages/api/graphql.ts
-
curl -L -o graphql.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/examples/api-routes-apollo-server-and-client-auth/pages/api/graphql.ts
480 Bytes
| import { ApolloServer } from "@apollo/server"; | |
| import { startServerAndCreateNextHandler } from "@as-integrations/next"; | |
| import { NextApiRequest, NextApiResponse } from "next"; | |
| import { schema } from "../../apollo/schema"; | |
| type ExampleContext = { | |
| req: NextApiRequest; | |
| res: NextApiResponse; | |
| }; | |
| const apolloServer = new ApolloServer<ExampleContext>({ schema }); | |
| export default startServerAndCreateNextHandler(apolloServer, { | |
| context: async (req, res) => ({ req, res }), | |
| }); | |