Temporary workaround to not depend on configuration changes
This commit is contained in:
parent
a684bead92
commit
93edf07da8
@ -202,6 +202,11 @@ module.exports = class ApiRouter {
|
|||||||
app.layergroupAffectedTablesCache = this.layergroupAffectedTablesCache;
|
app.layergroupAffectedTablesCache = this.layergroupAffectedTablesCache;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: remove it before releasing next major version
|
||||||
|
if (!Array.isArray(routes)) {
|
||||||
|
routes = [ routes ];
|
||||||
|
}
|
||||||
|
|
||||||
routes.forEach(route => {
|
routes.forEach(route => {
|
||||||
const apiRouter = router({ mergeParams: true });
|
const apiRouter = router({ mergeParams: true });
|
||||||
const { paths, middlewares = [] } = route;
|
const { paths, middlewares = [] } = route;
|
||||||
|
@ -129,6 +129,11 @@ module.exports = class MapRouter {
|
|||||||
route (apiRouter, routes) {
|
route (apiRouter, routes) {
|
||||||
const mapRouter = router({ mergeParams: true });
|
const mapRouter = router({ mergeParams: true });
|
||||||
|
|
||||||
|
// TODO: remove it before releasing next major version
|
||||||
|
if (!Array.isArray(routes)) {
|
||||||
|
routes = [ routes ];
|
||||||
|
}
|
||||||
|
|
||||||
routes.forEach(route => {
|
routes.forEach(route => {
|
||||||
const { paths, middlewares = [] } = route;
|
const { paths, middlewares = [] } = route;
|
||||||
|
|
||||||
|
@ -57,6 +57,12 @@ module.exports = class TemplateRouter {
|
|||||||
route (apiRouter, routes) {
|
route (apiRouter, routes) {
|
||||||
const templateRouter = router({ mergeParams: true });
|
const templateRouter = router({ mergeParams: true });
|
||||||
|
|
||||||
|
// TODO: remove it before releasing next major version
|
||||||
|
if (!Array.isArray(routes)) {
|
||||||
|
routes = [ routes ];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
routes.forEach(route => {
|
routes.forEach(route => {
|
||||||
const { paths, middlewares = [] } = route;
|
const { paths, middlewares = [] } = route;
|
||||||
|
|
||||||
|
@ -33,6 +33,12 @@ module.exports = function createServer (serverOptions) {
|
|||||||
app.set('json replacer', jsonReplacer());
|
app.set('json replacer', jsonReplacer());
|
||||||
|
|
||||||
const apiRouter = new ApiRouter({ serverOptions, environmentOptions: global.environment });
|
const apiRouter = new ApiRouter({ serverOptions, environmentOptions: global.environment });
|
||||||
|
|
||||||
|
// TODO: remove it before releasing next major version
|
||||||
|
if (!Array.isArray(serverOptions.routes.api)) {
|
||||||
|
serverOptions.routes.api = [ serverOptions.routes.api ];
|
||||||
|
}
|
||||||
|
|
||||||
apiRouter.route(app, serverOptions.routes.api);
|
apiRouter.route(app, serverOptions.routes.api);
|
||||||
|
|
||||||
const versions = getAndValidateVersions(serverOptions);
|
const versions = getAndValidateVersions(serverOptions);
|
||||||
|
Loading…
Reference in New Issue
Block a user