Skip to content

Commit

Permalink
document express customization of express endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
EmrysMyrddin committed Apr 28, 2023
1 parent 39714eb commit e31103a
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions website/src/pages/docs/integrations/integration-with-express.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,24 @@ app.listen(4000, () => {
```

> You can also check a full example on our GitHub repository [here](https://github.com/dotansimha/graphql-yoga/tree/v3/examples/express)
## Custom endpoint

By default, GraphQL Yoga will bind to the `/graphql` endpoint. You can change this behavior by passing a `graphqlEndpoint` option to the `createYoga` function.

```ts
import express from 'express'
import { createYoga } from 'graphql-yoga'

const app = express()

const yoga = createYoga({
graphqlEndpoint: '/custom/endpoint'
})

app.use('/custom/endpoint', yoga)

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

0 comments on commit e31103a

Please sign in to comment.