-
Notifications
You must be signed in to change notification settings - Fork 848
Closed
Labels
Description
In the express-graphql implementation there is an example of how to pass addition variables to the resolve function in the rootValue key. Example:
app.use('/graphql', graphqlHTTP(request => ({
schema: MySessionAwareGraphQLSchema,
rootValue: { session: request.session },
graphiql: true
})));The session value is then accessed in the resolve function of a schema type:
new GraphQLObjectType({
name: 'MyType',
fields: {
myField: {
type: GraphQLString,
resolve(parentValue, _, { rootValue: { session } }) {
// use `session` here
}
}
}
});Is there any documentation/example on how to pass and access root values from resolve functions in graphql go?