Skip to content

Commit 6bef900

Browse files
authored
docs: correct Hive Gateway Next.js example (#6481)
1 parent 280f4d1 commit 6bef900

File tree

1 file changed

+7
-10
lines changed
  • packages/web/docs/src/content/gateway/deployment/node-frameworks

1 file changed

+7
-10
lines changed

packages/web/docs/src/content/gateway/deployment/node-frameworks/nextjs.mdx

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,18 @@ Hive Gateway can be integrated with Next.js easily as
1414

1515
## Example
1616

17-
```ts
18-
// Next.js Custom Route Handler: https://nextjs.org/docs/app/building-your-application/routing/router-handlers
17+
Please read the
18+
[relevant Next.js documentation on custom router handlers](https://nextjs.org/docs/app/building-your-application/routing/router-handlers)
19+
first.
1920

21+
```ts filename="app/api/route.ts"
2022
import { createGatewayRuntime } from '@graphql-hive/gateway-runtime'
23+
import { supergraph } from './my-supergraph'
2124

2225
const { handleRequest } = createGatewayRuntime({
23-
/* Your configuration here before the following required settings */
24-
25-
// While using Next.js file convention for routing, we need to configure Hive Gateway to use the correct endpoint
26-
graphqlEndpoint: '/api/graphql',
27-
28-
// Hive Gateway needs to know how to create a valid Next response
29-
fetchAPI: { Response }
26+
supergraph,
27+
graphqlEndpoint: '/api/graphql'
3028
})
3129

32-
// Export the handler to be used with the following HTTP methods
3330
export { handleRequest as GET, handleRequest as POST, handleRequest as OPTIONS }
3431
```

0 commit comments

Comments
 (0)