Learn-GraphQL
Learn-GraphQL copied to clipboard
  
"express-graphql": "^0.12.0" does not work with the method expressGraphQL, `use const { graphqlHTTP } = require('express-graphql');` or `const expressGraphQL = require('express-graphql').graphqlHTTP` Refer [https://stackoverflow.com/questions/65517979/expressgraphql-is-not-a-function](url)
for some reason, constructor GraphQLNonNull doesn't work with graphql package version 16+ resulting in the error message: TypeError: Class constructor GraphQLNonNull cannot be invoked without 'new'
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...
**Before :** `const expressGraphQL = require("express-graphql");` --- **After :** `const { graphqlHTTP } = require("express-graphql");` --- ## This is the correct way, as described in the documentation. #### `const expressGraphQL`...