Create .middlewares() method to return the middlewares to process the request

This commit is contained in:
Daniel García Aubert
2018-05-11 15:34:10 +02:00
parent 242224396d
commit 3d7231929c
2 changed files with 58 additions and 51 deletions
@@ -46,10 +46,14 @@ module.exports = class TileLayergroupController {
const not = (val) => `(?!${val})([^\/]+?)`;
mapRouter.get([
`/:token/:z/:x/:y@:scale_factor?x.:format`,
`/:token/:z/:x/:y.:format`,
`/:token${not('static')}/:layer/:z/:x/:y.(:format)`
],
`/:token/:z/:x/:y@:scale_factor?x.:format`,
`/:token/:z/:x/:y.:format`,
`/:token${not('static')}/:layer/:z/:x/:y.(:format)`
], this.middlewares());
}
middlewares () {
return [
layergroupToken(),
coordinates(),
credentials(),
@@ -72,7 +76,7 @@ module.exports = class TileLayergroupController {
incrementErrorMetrics(global.statsClient),
tileError(),
vectorError()
);
];
}
};