From 07dec2e64138760a12ccd0a1b80d99858230a4d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Garc=C3=ADa=20Aubert?= Date: Fri, 11 May 2018 12:38:52 +0200 Subject: [PATCH] Create .middlwares() to return a set of middlewares to be mounted --- lib/cartodb/api/map/analysis-layergroup-controller.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/cartodb/api/map/analysis-layergroup-controller.js b/lib/cartodb/api/map/analysis-layergroup-controller.js index 8a22dd09..41acf819 100644 --- a/lib/cartodb/api/map/analysis-layergroup-controller.js +++ b/lib/cartodb/api/map/analysis-layergroup-controller.js @@ -16,8 +16,11 @@ module.exports = class AnalysisLayergroupController { } register (mapRouter) { - mapRouter.get( - `/:token/analysis/node/:nodeId`, + mapRouter.get('/:token/analysis/node/:nodeId', this.middlewares()); + } + + middlewares () { + return [ layergroupToken(), credentials(), authorize(this.authBackend), @@ -25,7 +28,7 @@ module.exports = class AnalysisLayergroupController { rateLimit(this.userLimitsBackend, RATE_LIMIT_ENDPOINTS_GROUPS.ANALYSIS), cleanUpQueryParams(), analysisNodeStatus(this.analysisStatusBackend) - ); + ]; } };