diff --git a/lib/configuration/hooks/router/index.js b/lib/configuration/hooks/router/index.js index 30f48ffc60..bc06a6867f 100644 --- a/lib/configuration/hooks/router/index.js +++ b/lib/configuration/hooks/router/index.js @@ -115,10 +115,10 @@ module.exports = function (strapi) { // Define GraphQL route to GraphQL schema // or disable the global variable if (this.defaults.graphql.enabled === true) { - strapi.router.get(this.defaults.graphql.route, strapi.middlewares.graphql({ + strapi.app.use(strapi.middlewares.mount(this.defaults.graphql.route, strapi.middlewares.graphql({ schema: strapi.schemas, pretty: true - })); + }))); } else { global.graphql = undefined; }