Skip to content

docs(express.mdx): describe renderGraphiQL option usage #6822

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,30 @@ app.listen(4000, () => {
})
```

## Offline Usage

By default, GraphiQL code is served from a CDN because to decrease bundle size. If you want to use
GraphiQL from a local version, you need to install it manually.

You need to pass imported `renderGraphiQL` to `createGatewayRuntime` like below:

```ts filename="Render GraphiQL offline"
import express from 'express'
import { createGatewayRuntime } from '@graphql-hive/gateway-runtime'
import { renderGraphiQL } from '@graphql-yoga/render-graphiql'

const app = express()

const serveRuntime = createGatewayRuntime({ renderGraphiQL })

// Bind Hive Gateway to the graphql endpoint to avoid rendering the playground on any path
app.use(serveRuntime.graphqlEndpoint, serveRuntime)

app.listen(4000, () => {
console.log('Running a GraphQL API server at http://localhost:4000/graphql')
})
```

## Using Helmet

If you are using [Helmet](https://helmetjs.github.io/) to set your
Expand Down
Loading