I can't seem to access the GraphQL Playground using NestJS. I'm exploring the documentation and have followed this https://docs.nestjs.com/graphql/quick-start up to the Resolvers section to generate the schema.gql
, but attempting to reach localhost:3000/graphql
is not able to connect.
At first I thought my code was setup incorrectly, but I spent some time digging into Nest's examples and found that those also do not work when trying to access the /graphql
endpoint. It does work if I setup a get
endpoint to return a JSON body using the REST method.
import { Module } from '@nestjs/common';
import { GraphQLModule } from '@nestjs/graphql';
import { RecipesModule } from './recipes/recipes.module';
@Module({
imports: [
RecipesModule,
GraphQLModule.forRoot({
installSubscriptionHandlers: true,
autoSchemaFile: 'schema.gql',
}),
],
})
export class AppModule {}
This is directly from the NestJS example. My understanding is that the GraphQLModule should be setting up the connection to the /graphql
endpoint. Following the docs, graphql, apollo-server-express, and graphql-tools
were all installed.
Any idea why the graphql route is not connecting?
[Edit]: Things I've tried so far:
playground: true
explicitly with GraphQLModule.forRootNODE_ENV
is not 'production'localhost:3000/graphql
and receive a graphql validation error, so confirm that connects correctlySeems to be an issue with WSL2 running on Windows 10. This thread on github has some insight into the issue.
Disable Fast Startup to allow access to localhost.