From ed5203d445809c60f6c66dde1b0ae327124efe94 Mon Sep 17 00:00:00 2001 From: sveisvei Date: Wed, 28 Dec 2016 21:04:26 +0100 Subject: [PATCH] add app hooks --- lib/app.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/app.js b/lib/app.js index afc4dc31fb..a78b61f0d7 100644 --- a/lib/app.js +++ b/lib/app.js @@ -23,6 +23,11 @@ module.exports = function (config) { app.set('trust proxy'); app.set('port', config.port); app.locals.baseUriPath = baseUriPath; + + if (typeof config.preHook === 'function') { + config.preHook(app); + } + app.use(cookieParser()); if (publicFolder) { @@ -49,6 +54,10 @@ module.exports = function (config) { })); } + if (typeof config.preRouterHook === 'function') { + config.preRouterHook(app); + } + // Setup API routes const apiRouter = express.Router(); // eslint-disable-line new-cap routes.createAPI(apiRouter, config);