I am learning GraphQL for my project using this tutorial: https://www.youtube.com/watch?v=ZQL7tL2S0oQ&ab_channel=WebDevSimplified
and I get the error:
TypeError: expressGraphQL is not a function
at Object.<anonymous>
I have already tried:
- this solution: graphqlHTTP is not a function - the program crashes all the same with {} parentheses and without them
- adding a semicolon after various lines
The code for now looks like this:
const express = require ('express')
const { expressGraphQL } = require('express-graphql')
const app = express();
app.use('/graphql', expressGraphQL({
graphiql: true,
})
)
app.listen(5000., () => console.log('Server Running'))
If I comment out this section:
app.use('/graphql', expressGraphQL({
graphiql: true,
})
)
the code works perfectly fine both with {} parentheses and without them.