node.jsapollo-servergraphql-playground

How to disable apollo sandbox and launch playground?


I was using apollo-server and when I needed to get access to the playground I only put localhost:4000 and I got access to Playground, but now when I try to get access to playground is redirected to the sandbox, the question is about how can I disable that behaviour and launch playground instead of the sandbox.

Thanks.


Solution

  • This change that you're experiencing might have been caused by upgrading (maybe accidentally or automatically) from Apollo Server v2 to v3. The v3.0.0 release of Apollo Server happened 10 days ago.

    Apollo Server v3 changed the default behavior of the server's landing page, but you can still configure the GraphQL Playground by following these instructions.

    import { ApolloServer } from "apollo-server";
    import {
      ApolloServerPluginLandingPageGraphQLPlayground
    } from "apollo-server-core";
    
    const server = new ApolloServer({
      typeDefs,
      resolvers,
      plugins: [
        ApolloServerPluginLandingPageGraphQLPlayground(),
      ],
    });