Kimo
05/08/2018, 4:50 PMgraphiql
in the browser. It worked with graphql-playground
before but right now I keep getting Server cannot be reached
error. graphiql
works perfectly. Here's my main server file:
const express = require('express');
const { graphqlExpress, graphiqlExpress } = require('graphql-server-express');
const bodyParser = require('body-parser');
const schema = require('./schema');
const resolvers = require('./resolvers');
const { execute, subscribe } = require('graphql');
const { SubscriptionServer } = require('subscriptions-transport-ws');
const { createServer } = require('http');
const PORT = 3500;
const app = express();
// The GraphQL endpoint
app.use('/graphql', bodyParser.json(), graphqlExpress({ schema }));
// GraphiQL, a visual editor for queries
app.use('/graphiql', graphiqlExpress({
endpointURL: '/graphql',
subscriptionsEndpoint: `<ws://localhost:${PORT}/subscriptions>`
}));
var ws = createServer(app);
ws.listen(PORT, ()=> {
console.log("Server Running on Port:", PORT);
new SubscriptionServer({
execute,
subscribe,
schema
}, {
server: ws,
path: '/subscriptions',
});
});
Does graphql-playground work with any graphql server that's not prisma or graphcool?
I'm using the latest version of graphql-playground
.nilan
05/08/2018, 4:52 PMDoes graphql-playground work with any graphql server that's not prisma or graphcool?yes. I can't see any reference to
graphql-playground
in your code, do you use the Electron app?Kimo
05/08/2018, 4:55 PMnilan
05/08/2018, 4:55 PMI thought graphql-playground was just a query editor which should be able to connect to any graphql server.That's correct.
Do I need to do something to allow my server to be accessed by graphql-playground?No.
nilan
05/08/2018, 4:56 PMKimo
05/08/2018, 4:59 PMnilan
05/08/2018, 4:59 PM<http://localhost:3500/graphql>
from the Playgroundnilan
05/08/2018, 4:59 PMgraphiql
Kimo
05/08/2018, 5:02 PM