I have this in my app.js
const express = require('express');
const bodyParser = require('body-parser');
const graphqlHttp = require('express-graphql').graphqlHTTP;
const { buildSchema } = require('graphql');
const app = express();
app.use(bodyParser.json());
app.use(
'/myproject',
graphqlHttp({
schema: buildSchema(`
type TypeQuery {
events: [String!]!
}
type TypeMutation {
createEvent(name: String): String
}
schema {
query: TypeQuery
mutation: TypeMutation
}
`),
rootValue: {
events: () => {
return ['Cats', 'Sailing'];
},
createEvent: (args) => {
const eventName = args.name;
return eventName;
},
},
graphql: true,
})
);
app.listen(3000);
When I typed in browser 'http://localhost:3000/myproject' I getting this error:
{"errors":[{"message":"Must provide query string."}]}
What I am wrong? In my project only change I made was in app.js. I don't have a frontend. Thank you