Skip to content

Commit e31103a

Browse files
committed
document express customization of express endpoint
1 parent 39714eb commit e31103a

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

website/src/pages/docs/integrations/integration-with-express.mdx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,24 @@ app.listen(4000, () => {
3737
```
3838

3939
> You can also check a full example on our GitHub repository [here](https://github.com/dotansimha/graphql-yoga/tree/v3/examples/express)
40+
41+
## Custom endpoint
42+
43+
By default, GraphQL Yoga will bind to the `/graphql` endpoint. You can change this behavior by passing a `graphqlEndpoint` option to the `createYoga` function.
44+
45+
```ts
46+
import express from 'express'
47+
import { createYoga } from 'graphql-yoga'
48+
49+
const app = express()
50+
51+
const yoga = createYoga({
52+
graphqlEndpoint: '/custom/endpoint'
53+
})
54+
55+
app.use('/custom/endpoint', yoga)
56+
57+
app.listen(4000, () => {
58+
console.log('Running a GraphQL API server at http://localhost:4000/graphql')
59+
})
60+
```

0 commit comments

Comments
 (0)