Node.js based forum software built for the modern web
wait for all routes to load before listening
barisusakli449352d8996b
diff --git a/src/plugins.js b/src/plugins.jsindex 3c2f8ce790..7c2ecaee25 100644--- a/src/plugins.js+++ b/src/plugins.js@@ -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);diff --git a/src/routes/index.js b/src/routes/index.jsindex d0029798de..57b1d5c942 100644--- a/src/routes/index.js+++ b/src/routes/index.js@@ -85,7 +85,7 @@ function groupRoutes(app, middleware, controllers) {setupPageRoute(app, '/groups/:slug/members', middleware, middlewares, controllers.groups.members);}-module.exports = function (app, middleware, hotswapIds) {+module.exports = function (app, middleware, hotswapIds, callback) {var routers = [express.Router(), // plugin routerexpress.Router(), // main app router@@ -209,8 +209,9 @@ module.exports = function (app, middleware, hotswapIds) {async.apply(user.addInterstitials),], function (err) {if (err) {- return winston.error(err);+ return callback(err);}winston.info('Routes added');+ callback();});};diff --git a/src/webserver.js b/src/webserver.jsindex e254d71008..09da4a4d08 100644--- a/src/webserver.js+++ b/src/webserver.js@@ -96,8 +96,7 @@ function initializeNodeBB(callback) {plugins.fireHook('filter:hotswap.prepare', [], next);},function (hotswapIds, next) {- routes(app, middleware, hotswapIds);- next();+ routes(app, middleware, hotswapIds, next);},function (next) {async.series([