Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) Safe-mode: OFF (not secure) /var/www/html/wincloud_gateway/node_modules/strapi/lib/middlewares/router/ drwxr-xr-x | |
| Viewing file: Select action/file-type: 'use strict';
/**
* Module dependencies
*/
// Public node modules.
const _ = require('lodash');
const Router = require('koa-router');
const createEndpointComposer = require('./utils/composeEndpoint');
/**
* Router hook
*/
module.exports = strapi => {
const composeEndpoint = createEndpointComposer(strapi);
return {
/**
* Initialize the hook
*/
initialize() {
_.forEach(strapi.config.routes, value => {
composeEndpoint(value, { router: strapi.router });
});
strapi.router.prefix(strapi.config.get('middleware.settings.router.prefix', ''));
if (_.has(strapi.admin, 'config.routes')) {
const router = new Router({
prefix: '/admin',
});
_.get(strapi.admin, 'config.routes', []).forEach(route => {
composeEndpoint(route, { plugin: 'admin', router });
});
// Mount admin router on Strapi router
strapi.app.use(router.routes()).use(router.allowedMethods());
}
if (strapi.plugins) {
// Parse each plugin's routes.
_.forEach(strapi.plugins, (plugin, pluginName) => {
const router = new Router({
prefix: `/${pluginName}`,
});
(plugin.config.routes || []).forEach(route => {
const hasPrefix = _.has(route.config, 'prefix');
composeEndpoint(route, {
plugin: pluginName,
router: hasPrefix ? strapi.router : router,
});
});
// Mount plugin router
strapi.app.use(router.routes()).use(router.allowedMethods());
});
}
},
};
};
|
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.1206 ]-- |