Skip to content

Graphiql:true not working - {"errors":[{"message":"Missing query"}]} #86

@faisvsqrl

Description

@faisvsqrl

Created new fresh project followed steps from provided documentation and I set graphiql:true and hit localhost:3001/graphql from browser so it's just showing following error instead graphqlUI.

{"errors":[{"message":"Missing query"}]}

`const express = require('express');
const app = express();
const port = 3001;
const { createHandler } = require('graphql-http/lib/use/express');

const { GraphQLSchema, GraphQLObjectType, GraphQLString } = require('graphql');

const schema = new GraphQLSchema({
query: new GraphQLObjectType({
name: 'Query',
fields: {
hello: {
type: GraphQLString,
resolve: () => 'world',
},
},
}),
});

app.get('/', (req, res) => {
res.send('Hello World!')
})

// Create a express instance serving all methods on /graphql
app.all('/graphql', createHandler({ schema,graphiql:true }));

app.listen(port, () => {
console.log(Example app listening on port ${port})
})`

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions