You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Next.js `req` and `res` objects are passed along to the context function.
46
+
47
+
## Route Handlers (experimental)
48
+
49
+
This integration has experimental support for Next.js' new Route Handlers feature.
50
+
51
+
To use this integration with Route Handlers, first opt into Next.js' beta app directory by adding the following to `next.config.js`:
52
+
53
+
```js
54
+
module.exports= {
55
+
experimental: {
56
+
appDir:true,
57
+
},
58
+
};
59
+
```
60
+
61
+
Then create a new file at for example `app/graphql/route.js`.
62
+
This file's route handlers will be accessible at `/graphql`.
63
+
64
+
Next create an Apollo Server instance, pass it to `startServerAndCreateNextHandler` and finally pass the handler to both a GET and a POST route handler:
When using this integration with Route Handlers you will have to specify the type of the incoming request object (`Response` or `NextResponse`) for the context function to receive the correct type signature:
0 commit comments