Send context in rootValue variable

This commit is contained in:
Aurélien Georget 2016-03-02 17:53:07 +01:00
parent 112a956bab
commit 8c2f7cf8a6

View File

@ -115,10 +115,13 @@ module.exports = function (strapi) {
// Define GraphQL route to GraphQL schema
// or disable the global variable
if (this.defaults.graphql.enabled === true) {
strapi.app.use(strapi.middlewares.mount(this.defaults.graphql.route, strapi.middlewares.graphql({
strapi.app.use(strapi.middlewares.mount(this.defaults.graphql.route, strapi.middlewares.graphql((request, context) => ({
schema: strapi.schemas,
pretty: true
})));
pretty: true,
rootValue: {
context: context
}
}))));
} else {
global.graphql = undefined;
}