小编Kin*_*ian的帖子

GraphQL"不能为非空值返回null"

试图创建我的第一个graphQL服务器,这是我到目前为止所写的内容.

https://gist.github.com/tharakabimal/7f2947e805e69f67af2b633268db0406

当我尝试按用户名过滤用户时,GraphQL上会弹出以下错误.

GraphQL出错

UserQueriesQL.js中的users字段中发生错误.

我在解析函数上传递参数的方式有什么不对吗?

user: {
type: UserType,
args: { 
  username: {
    name: 'username',
    type: new GraphQLNonNull(GraphQLString)
  }
},
resolve: function(parentValue, args) {
  return User.find( args ).exec();
}
Run Code Online (Sandbox Code Playgroud)

javascript node.js express graphql

13
推荐指数
2
解决办法
2万
查看次数

标签 统计

express ×1

graphql ×1

javascript ×1

node.js ×1