Learn-GraphQL
Learn-GraphQL copied to clipboard
Starting a server gives Error - TypeError: expressGraphQL is not a function
Hi, found a solution for this error when starting a server, so sharing:
I just changed a line when requiring express-graphql to:
const expressGraphQL = require('express-graphql').graphqlHTTP
Now it starts ok.
and another simple fix for it would be
// const expressGraphql = require("express-graphql");
const { graphqlHTTP } = require("express-graphql");
app.use("/graphql", graphqlHTTP({
schema,
graphiql: true,
})
);