4

I am using Apollo server to implement a GraphQL API, which automatically gives me a GraphQL Playground. According to the GraphQL Playground docs I should have (or at least be able to enable) a "Share" feature that will create a GraphQL Bin link (e.g. https://graphqlbin.com/OksD) that I could send to a colleague so they can view and run my same query.

Unfortunately this isn't available from Apollo server out of the box. How can I enable this feature? If this is not possible, is there another simple way for me to export my query from GraphQL Playground for someone else to import it? (I see the "copy curl" option, but I don't see an easy way to import from curl.)

GraphQL Bin Image

Calaway
  • 714
  • 6
  • 12
  • There's several open issues to that effect, like [this one](https://github.com/prisma-labs/graphql-playground/issues/1062). – Daniel Rearden Jan 30 '20 at 21:54

1 Answers1

5

Add shareEnabled: true to your playground options, e.g.

        const apolloServer = new ApolloServer({
                schema,
                debug: isDevelopment,
                introspection: isDevelopment,
                playground: {
                    shareEnabled: true,    
                },
        });

You might also want to fix CORS origin headers, allowing requests from https://graphqlbin.com

Andi
  • 199
  • 2
  • 9
  • This worked great. Thank you! Do you know if this is included anywhere in their documentation. I don't see it on the graphql-playground readme. It would be nice to see all available options on the documentation. – Calaway Feb 04 '20 at 18:21
  • I would also love to know where this is all documented. I have not found it anywhere. – micnguyen Jun 07 '21 at 07:26