mirror of
https://github.com/strapi/strapi.git
synced 2025-11-12 16:22:10 +00:00
Merge branch 'improvement/structure' of github.com:wistityhq/strapi into improvement/structure
* 'improvement/structure' of github.com:wistityhq/strapi: Fix API name issue Handle new architecture from module to api
This commit is contained in:
commit
a843b5e4b2
@ -30,6 +30,11 @@ module.exports = function (strapi) {
|
|||||||
_.forEach(strapi.api, function (definition, api) {
|
_.forEach(strapi.api, function (definition, api) {
|
||||||
async.auto({
|
async.auto({
|
||||||
|
|
||||||
|
// Expose the `name` of the API for the callback.
|
||||||
|
'name': function (cb) {
|
||||||
|
cb(null, api)
|
||||||
|
},
|
||||||
|
|
||||||
// Load API controllers from `./api/*/controllers/*.js`.
|
// Load API controllers from `./api/*/controllers/*.js`.
|
||||||
'controllers/*': function (cb) {
|
'controllers/*': function (cb) {
|
||||||
dictionary.optional({
|
dictionary.optional({
|
||||||
@ -111,7 +116,7 @@ module.exports = function (strapi) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Expose the API dictionary.
|
// Expose the API dictionary.
|
||||||
strapi.api[api] = {
|
strapi.api[api.name] = {
|
||||||
controllers: api['controllers/*'],
|
controllers: api['controllers/*'],
|
||||||
models: api['models/*'],
|
models: api['models/*'],
|
||||||
services: api['services/*'],
|
services: api['services/*'],
|
||||||
@ -123,16 +128,16 @@ module.exports = function (strapi) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Merge API controllers with the main ones.
|
// Merge API controllers with the main ones.
|
||||||
strapi.controllers = _.merge(strapi.controllers, strapi.api[api].controllers);
|
strapi.controllers = _.merge(strapi.controllers, strapi.api[api.name].controllers);
|
||||||
|
|
||||||
// Merge API models with the main ones.
|
// Merge API models with the main ones.
|
||||||
strapi.models = _.merge(strapi.models, strapi.api[api].models);
|
strapi.models = _.merge(strapi.models, strapi.api[api.name].models);
|
||||||
|
|
||||||
// Merge API policies with the main ones.
|
// Merge API policies with the main ones.
|
||||||
strapi.policies = _.merge(strapi.policies, strapi.api[api].policies);
|
strapi.policies = _.merge(strapi.policies, strapi.api[api.name].policies);
|
||||||
|
|
||||||
// Merge API routes with the main ones.
|
// Merge API routes with the main ones.
|
||||||
strapi.config.routes = _.merge(strapi.config.routes, strapi.api[api].config.routes);
|
strapi.config.routes = _.merge(strapi.config.routes, strapi.api[api.name].config.routes);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -480,7 +480,7 @@ module.exports = function (strapi) {
|
|||||||
let folderDest;
|
let folderDest;
|
||||||
const folderOrFiletoRemove = path.resolve(data.dest);
|
const folderOrFiletoRemove = path.resolve(data.dest);
|
||||||
|
|
||||||
if (data.src === 'modules') {
|
if (data.src === 'api') {
|
||||||
folderDest = folderOrFiletoRemove;
|
folderDest = folderOrFiletoRemove;
|
||||||
} else {
|
} else {
|
||||||
folderDest = path.resolve(data.dest, '..');
|
folderDest = path.resolve(data.dest, '..');
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user