【发布时间】:2018-05-31 01:00:47
【问题描述】:
我正在尝试以 express 方式运行 graphql 服务器。但它会引发以下错误。
var graphqlHTTP = require('express-graphql'); // express graphql
var { buildSchema } = require('graphql'); // graphql
var schema=buildSchema(
type Query {
name:String});
var classifyRoot={
name:()=>{
classified.find({name:"shoes"},function(err,classified){
//res.render("card",{classifieds:classifieds});
return classified.name;
});
},};
app.use('/graphql', graphqlHTTP({
schema: schema,
rootValue: classifyRoot,
graphiql: true,
}));
【问题讨论】:
-
我认为您需要提供更多代码,仅凭错误就没有什么可处理的
-
您好,感谢回复,请查找更新后的代码
-
那么错误在哪一行?这几乎肯定只是某个地方的错字
标签: node.js express graphql express-graphql