问题描述
我正在使用本教程为我的项目学习 GraphQL: https://www.youtube.com/watch?v=ZQL7tL2S0oQ&ab_channel=WebDevSimplified
然后我收到错误:
TypeError: expressGraphQL is not a function
at Object.<anonymous>
我已经试过了:
- 此解决方案:graphqlHTTP is not a function - 有 {} 括号和没有括号的程序都会崩溃
- 在多行后添加分号
现在的代码如下所示:
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'))
如果我注释掉这部分:
app.use('/graphql',expressGraphQL({
graphiql: true,})
)
无论使用 {} 括号还是不使用括号,代码都可以正常工作。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)