graphql / graphql-playground

🎮 GraphQL IDE for better development workflows (GraphQL Subscriptions, interactive docs & collaboration)
MIT License
8.73k stars 731 forks source link

How to set playground only for specific env? #1388

Open lfaz opened 2 years ago

lfaz commented 2 years ago

I tried something like:

 app.get(
        '/playground',
        expressPlayground({
            endpoint: '/graphql',
            env: 'development'
        })
  );

Obviously doesnt seem to work. I could

I could make it work smth like:

    if (process.env.NODE_ENV === 'development') {
        app.get(
            '/playground',
            expressPlayground({
                endpoint: '/graphql',
            })
        );
    }

but to me doesnt seem very nice solution.