mirror of
https://github.com/strapi/strapi.git
synced 2025-11-17 18:51:22 +00:00
chore: replace koa-router-joi (strapi fork) by original and maintained
koa-joi-router Upgrade some dependencies
This commit is contained in:
parent
b1eccc05a7
commit
04b4003bf2
@ -102,6 +102,7 @@
|
|||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"gitHead": "c85658a19b8fef0f3164c19693a45db305dc07a9",
|
"gitHead": "c85658a19b8fef0f3164c19693a45db305dc07a9",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"webpack": "^4.29.6",
|
||||||
"webpack-cli": "^3.3.2",
|
"webpack-cli": "^3.3.2",
|
||||||
"webpack-dev-server": "^3.4.1"
|
"webpack-dev-server": "^3.4.1"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,6 +26,7 @@
|
|||||||
"strapi-utils": "3.0.0-beta.6"
|
"strapi-utils": "3.0.0-beta.6"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"koa": "^2.1.0",
|
||||||
"cross-env": "^5.2.0",
|
"cross-env": "^5.2.0",
|
||||||
"rimraf": "^2.6.3"
|
"rimraf": "^2.6.3"
|
||||||
},
|
},
|
||||||
|
|||||||
@ -36,6 +36,9 @@
|
|||||||
"strapi-utils": "3.0.0-beta.6",
|
"strapi-utils": "3.0.0-beta.6",
|
||||||
"uuid": "^3.1.0"
|
"uuid": "^3.1.0"
|
||||||
},
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"koa": "^2.1.0"
|
||||||
|
},
|
||||||
"author": {
|
"author": {
|
||||||
"name": "Strapi team",
|
"name": "Strapi team",
|
||||||
"email": "hi@strapi.io",
|
"email": "hi@strapi.io",
|
||||||
|
|||||||
2
packages/strapi/lib/core/bootstrap.js
vendored
2
packages/strapi/lib/core/bootstrap.js
vendored
@ -4,7 +4,7 @@ const _ = require('lodash');
|
|||||||
|
|
||||||
const { createController, createService } = require('../core-api');
|
const { createController, createService } = require('../core-api');
|
||||||
const getURLFromSegments = require('../utils/url-from-segments');
|
const getURLFromSegments = require('../utils/url-from-segments');
|
||||||
const routerJoi = require('koa-router-joi');
|
const routerJoi = require('koa-joi-router');
|
||||||
|
|
||||||
module.exports = function(strapi) {
|
module.exports = function(strapi) {
|
||||||
// Retrieve Strapi version.
|
// Retrieve Strapi version.
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
// Public node modules.
|
// Public node modules.
|
||||||
const _ = require('lodash');
|
const _ = require('lodash');
|
||||||
const routerJoi = require('koa-router-joi');
|
const routerJoi = require('koa-joi-router');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Router hook
|
* Router hook
|
||||||
|
|||||||
@ -12,7 +12,7 @@ const finder = require('strapi-utils').finder;
|
|||||||
const regex = require('strapi-utils').regex;
|
const regex = require('strapi-utils').regex;
|
||||||
const joijson = require('strapi-utils').joijson;
|
const joijson = require('strapi-utils').joijson;
|
||||||
const policyUtils = require('strapi-utils').policy;
|
const policyUtils = require('strapi-utils').policy;
|
||||||
const { Joi } = require('koa-router-joi');
|
const { Joi } = require('koa-joi-router');
|
||||||
|
|
||||||
module.exports = strapi =>
|
module.exports = strapi =>
|
||||||
function routerChecker(value, endpoint, plugin) {
|
function routerChecker(value, endpoint, plugin) {
|
||||||
@ -20,13 +20,20 @@ module.exports = strapi =>
|
|||||||
const route = regex.detectRoute(endpoint);
|
const route = regex.detectRoute(endpoint);
|
||||||
|
|
||||||
// Define controller and action names.
|
// Define controller and action names.
|
||||||
const handler = _.trim(value.handler).split('.');
|
const [controllerName, actionName] = _.trim(value.handler).split('.');
|
||||||
const controller = plugin
|
const controllerKey = _.toLower(controllerName);
|
||||||
? strapi.plugins[plugin].controllers[handler[0].toLowerCase()]
|
|
||||||
: strapi.controllers[handler[0].toLowerCase()] ||
|
|
||||||
strapi.admin.controllers[handler[0].toLowerCase()];
|
|
||||||
|
|
||||||
const action = controller[handler[1]];
|
let controller;
|
||||||
|
|
||||||
|
if (plugin) {
|
||||||
|
controller = strapi.plugins[plugin].controllers[controllerKey];
|
||||||
|
} else {
|
||||||
|
controller =
|
||||||
|
strapi.controllers[controllerKey] ||
|
||||||
|
strapi.admin.controllers[controllerKey];
|
||||||
|
}
|
||||||
|
|
||||||
|
const action = controller[actionName];
|
||||||
|
|
||||||
// Retrieve the API's name where the controller is located
|
// Retrieve the API's name where the controller is located
|
||||||
// to access to the right validators
|
// to access to the right validators
|
||||||
|
|||||||
@ -31,10 +31,10 @@
|
|||||||
"koa-favicon": "^2.0.0",
|
"koa-favicon": "^2.0.0",
|
||||||
"koa-i18n": "^2.1.0",
|
"koa-i18n": "^2.1.0",
|
||||||
"koa-ip": "^1.0.0",
|
"koa-ip": "^1.0.0",
|
||||||
|
"koa-joi-router": "^6.0.0",
|
||||||
"koa-locale": "~1.3.0",
|
"koa-locale": "~1.3.0",
|
||||||
"koa-lusca": "~2.2.0",
|
"koa-lusca": "~2.2.0",
|
||||||
"koa-qs": "^2.0.0",
|
"koa-qs": "^2.0.0",
|
||||||
"koa-router-joi": "^1.0.1",
|
|
||||||
"koa-session": "^5.5.1",
|
"koa-session": "^5.5.1",
|
||||||
"koa-static": "^4.0.1",
|
"koa-static": "^4.0.1",
|
||||||
"lodash": "^4.17.5",
|
"lodash": "^4.17.5",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user