试图创建我的第一个graphQL服务器,这是我到目前为止所写的内容.
https://gist.github.com/tharakabimal/7f2947e805e69f67af2b633268db0406
当我尝试按用户名过滤用户时,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)