In order to extract common middlewares between routers and controlles we need to activate mergeParams options to preserve the req.params from the parent router

This commit is contained in:
Daniel García Aubert
2018-05-14 11:50:48 +02:00
parent e5ddd57d65
commit 5a397afd06
3 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -191,7 +191,7 @@ module.exports = class ApiRouter {
Object.keys(this.serverOptions.routes).forEach(apiVersion => {
const routes = this.serverOptions.routes[apiVersion];
const apiRouter = router();
const apiRouter = router({ mergeParams: true });
apiRouter.use(logger(this.serverOptions));
apiRouter.use(initializeStatusCode());
+1 -1
View File
@@ -113,7 +113,7 @@ module.exports = class MapRouter {
}
register (apiRouter, mapPaths) {
const mapRouter = router();
const mapRouter = router({ mergeParams: true });
this.analysisLayergroupController.register(mapRouter);
this.attributesLayergroupController.register(mapRouter);
+1 -1
View File
@@ -53,7 +53,7 @@ module.exports = class TemplateRouter {
}
register (apiRouter, templatePaths) {
const templateRouter = router();
const templateRouter = router({ mergeParams: true });
this.namedMapController.register(templateRouter);
this.tileTemplateController.register(templateRouter);