Add comment

This commit is contained in:
Daniel García Aubert
2018-05-11 16:37:02 +02:00
parent c6babc7dc4
commit f4d60f963d
@@ -42,12 +42,15 @@ module.exports = class TileLayergroupController {
}
register (mapRouter) {
// REGEXP doesn't match with `val`
// REGEXP: doesn't match with `val`
const not = (val) => `(?!${val})([^\/]+?)`;
// Sadly the path that matches 1 also matches with 2 so we need to tell to express
// that performs only the middlewares of the first path that matches
// for that we use one array to group all paths.
mapRouter.get([
`/:token/:z/:x/:y@:scale_factor?x.:format`,
`/:token/:z/:x/:y.:format`,
`/:token/:z/:x/:y@:scale_factor?x.:format`, // 1
`/:token/:z/:x/:y.:format`, // 2
`/:token${not('static')}/:layer/:z/:x/:y.(:format)`
], this.middlewares());
}