mirror of
https://github.com/strapi/strapi.git
synced 2026-01-06 04:03:25 +00:00
Consider new configuration for dedicated GraphQL object
This commit is contained in:
parent
92a1d0d516
commit
75f11a7d0b
@ -23,7 +23,11 @@ module.exports = function (strapi) {
|
||||
|
||||
defaults: {
|
||||
prefix: '',
|
||||
routes: {}
|
||||
routes: {},
|
||||
graphql: {
|
||||
enabled: true,
|
||||
route: '/graphql'
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
@ -84,12 +88,10 @@ module.exports = function (strapi) {
|
||||
strapi.log.warn('Ignored attempt to bind route `' + endpoint + '` to unknown controller/action.');
|
||||
}
|
||||
});
|
||||
|
||||
if (strapi.config.globals.graphql === true || _.isPlainObject(strapi.config.globals.graphql)) {
|
||||
const GraphQLPath = _.isBoolean(strapi.config.globals.graphql) ? '/graphql' : strapi.config.globals.graphql.path;
|
||||
|
||||
|
||||
if (strapi.config.graphql.enabled === true) {
|
||||
// Define GraphQL route with modified Waterline models to GraphQL schema
|
||||
strapi.router.get(GraphQLPath, strapi.middlewares.graphql({
|
||||
strapi.router.get(strapi.config.graphql.route, strapi.middlewares.graphql({
|
||||
schema: strapi.schemas,
|
||||
pretty: true
|
||||
}));
|
||||
|
||||
@ -180,7 +180,7 @@ module.exports = function (strapi) {
|
||||
});
|
||||
});
|
||||
|
||||
if (strapi.config.globals.graphql === true) {
|
||||
if (strapi.config.graphql.enabled === true) {
|
||||
// Parse each models and add associations array
|
||||
_.forEach(strapi.orm.collections, function(collection, key) {
|
||||
if (strapi.models.hasOwnProperty(key)) {
|
||||
|
||||
@ -77,7 +77,7 @@
|
||||
"strapi-generate-users": "^1.1.0",
|
||||
"unzip2": "^0.2.5",
|
||||
"waterline": "^0.10.26",
|
||||
"waterline-to-graphql": "0.0.2",
|
||||
"waterline-graphql": "0.0.1",
|
||||
"winston": "^1.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user