wait for all routes to load before listening

This commit is contained in:
barisusakli
2017-03-16 11:24:31 +03:00
parent 2ef71e22aa
commit 449352d899
3 changed files with 6 additions and 6 deletions

View File

@@ -127,7 +127,6 @@ var middleware;
};
Plugins.reloadRoutes = function (callback) {
callback = callback || function () {};
var router = express.Router();
router.hotswapId = 'plugins';
@@ -138,7 +137,8 @@ var middleware;
var controllers = require('./controllers');
Plugins.fireHook('static:app.load', { app: app, router: router, middleware: middleware, controllers: controllers }, function (err) {
if (err) {
return winston.error('[plugins] Encountered error while executing post-router plugins hooks: ' + err.message);
winston.error('[plugins] Encountered error while executing post-router plugins hooks: ' + err.message);
return callback(err);
}
hotswap.replace('plugins', router);