docs: mention graphiql with apollo

This commit is contained in:
Kamil Myśliwiec
2025-04-14 12:34:18 +02:00
parent 83b86f0732
commit aa23855752

View File

@@ -88,19 +88,18 @@ With that in place, and with your application running in the background, you can
<img src="/assets/playground.png" alt="" />
</figure>
> warning **Note** `@nestjs/mercurius` integration does not ship with the built-in GraphQL Playground integration. Instead, you can use [GraphiQL](https://github.com/graphql/graphiql) (set `graphiql: true`).
> info **Note** `@nestjs/mercurius` integration does not ship with the built-in GraphQL Playground integration. Instead, you can use [GraphiQL](https://github.com/graphql/graphiql) (set `graphiql: true`).
#### Multiple endpoints
Another useful feature of the `@nestjs/graphql` module is the ability to serve multiple endpoints at once. This lets you decide which modules should be included in which endpoint. By default, `GraphQL` searches for resolvers throughout the whole app. To limit this scan to only a subset of modules, use the `include` property.
```typescript
GraphQLModule.forRoot({
include: [CatsModule],
}),
```
> warning **Warning** If you use the `@apollo/server` with `@as-integrations/fastify` package with multiple GraphQL endpoints in a single application, make sure to enable the `disableHealthCheck` setting in the `GraphQLModule` configuration.
> warning **Warning** Update (04/14/2025): The default Apollo playground has been deprecated and will be removed in the next major release. Instead, you can use [GraphiQL](https://github.com/graphql/graphiql), just set `graphiql: true` in the `GraphQLModule` configuration, as shown below:
>
> ```typescript
> GraphQLModule.forRoot<ApolloDriverConfig>({
> driver: ApolloDriver,
> graphiql: true,
> }),
> ```
>
> If your application uses [subscriptions](/graphql/subscriptions), be sure to use `graphql-ws`, as `subscriptions-transport-ws` isn't supported by GraphiQL.
#### Code first
@@ -356,6 +355,18 @@ export class AppModule {}
The `forRoot()` method takes an options object as an argument. These options are passed through to the underlying driver instance. Read more about available settings [here](https://github.com/mercurius-js/mercurius/blob/master/docs/api/options.md#plugin-options).
#### Multiple endpoints
Another useful feature of the `@nestjs/graphql` module is the ability to serve multiple endpoints at once. This lets you decide which modules should be included in which endpoint. By default, `GraphQL` searches for resolvers throughout the whole app. To limit this scan to only a subset of modules, use the `include` property.
```typescript
GraphQLModule.forRoot({
include: [CatsModule],
}),
```
> warning **Warning** If you use the `@apollo/server` with `@as-integrations/fastify` package with multiple GraphQL endpoints in a single application, make sure to enable the `disableHealthCheck` setting in the `GraphQLModule` configuration.
#### Third-party integrations
- [GraphQL Yoga](https://github.com/dotansimha/graphql-yoga)