Use .middlewares() method to build middleware stack to process the request

This commit is contained in:
Daniel García Aubert 2018-05-11 16:13:34 +02:00
parent 1f717617b0
commit 6eeb75a35e

View File

@ -17,8 +17,11 @@ function AnalysesController(pgConnection, authBackend, userLimitsBackend) {
module.exports = AnalysesController;
AnalysesController.prototype.register = function (mapRouter) {
mapRouter.get(
`/analyses/catalog`,
mapRouter.get('/analyses/catalog', this.middlewares());
};
AnalysesController.prototype.middlewares = function () {
return [
credentials(),
authorize(this.authBackend),
dbConnSetup(this.pgConnection),
@ -30,7 +33,7 @@ AnalysesController.prototype.register = function (mapRouter) {
prepareResponse(),
cacheControlHeader({ ttl: 10, revalidate: true }),
unauthorizedError()
);
];
};
function createPGClient () {