Trying to make my first graphQL server, here's what I have written so far.
https://gist.github.com/tharakabimal/7f2947e805e69f67af2b633268db0406
Following error pops up on GraphQL when I try to filter the users by username.
Error on GraphQL
The error occurs in the users field in UserQueriesQL.js.
Is there anything wrong the way I pass arguments on the resolve functions?
user: {
type: UserType,
args: {
username: {
name: 'username',
type: new GraphQLNonNull(GraphQLString)
}
},
resolve: function(parentValue, args) {
return User.find( args ).exec();
}
As I am beginner into GraphQL, even I ran into this issue. After going through each file individually I found that I forgot to import into my resolvers
import User from './User';
**import Post from './Post';**
const resolvers = [User, **Posts**];
Maybe this will help!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With