We were unable to load Disqus. If you are a moderator please see our troubleshooting guide.

theRobster16 • 5 years ago

Yup, my issue was the the HTTP in my graphqlHTTP import was lower case.
Changed it to

const graphqlHTTP = require('express-graphql")

Thanks to both of you guys

Mohshin Mostafa • 4 years ago

Wonderful Tutorial! Thank you so much for making it!

Ahmed Sohail • 4 years ago

will you please add subscription as well in your code

Alexander Kryklia • 5 years ago

Thank you, great article.

theRobster16 • 5 years ago

Getting an error that I'm not sure how to resolve

when I run npm start in the terminal, it throws this error

TypeError: graphqlHttp is not a function

Here's my code

const express = require("express")
const graphqlHttp = require("express-graphql")
const mongoose = require("mongoose")
const graphqlSchema = require("./graphql/schema")
const graphqlResolvers = require("./graphql/resolvers")


const app = express()


app.use(
"/graphql",
graphqlHttp({
schema: graphqlSchema,
rootValue: graphqlResolvers,
graphiql: true,
})
)

Tarek Bouzo • 5 years ago

const { graphqlHTTP } = require("express-graphql");

app.use(
"/graphql",
graphqlHTTP({
schema: buildSchema(`

koolstrings • 5 years ago

I think the import should have graphqlHTTP wrapped in curly brackets

theRobster16 • 5 years ago

Wait, I was think about that wrong. Yes, looking at the documentation on npm, it does simply show putting curly brackets at the import. However, I'm still getting the same error. Still looking into.
Thanks for your answer btw

theRobster16 • 5 years ago

Sorry, not 100% sure where you mean by at the import.

koolstrings • 5 years ago

yeah, I meant const {graphqlHTTP} = require("express-graphql")
what is the error you are getting now?
Also, check that that HTTP should be all caps in graphqlHTTP instead of graphqlHttp

quydo • 5 years ago

Cool