How to set a resolve?
codemeasandwich opened this issue · comments
I am trying to setup a helloworld, but dont know how to add a resolve?
I have tried adding one to "createType"
const user = mongoose.Schema({ name: String })
const User = createType({
name: 'User', schema: user,
class: 'GraphQLObjectType',
resolve:()=>({name:"Ann2"})
}); // END createType: User
and as a "rootValue"
app.use('/graphql', graphqlHTTP({
schema:new GraphQLSchema({ query:User }),
rootValue: {
User:()=>({ name:"Ann1" })
}, // END rootValue
graphiql: true
})); // END graphqlHTTP
but they ever get fired.
Thanks for any help