moved plugin route reloading outside of plugin initialisation, so plugins can add a hook listener before core routes have been added

This commit is contained in:
Julian Lam
2015-04-16 14:26:58 -04:00
parent 617808d574
commit 4fffe4da94
4 changed files with 21 additions and 5 deletions

View File

@@ -55,10 +55,21 @@ if(nconf.get('ssl')) {
async.apply(!skipLess ? meta.css.minify : meta.css.getFromFile),
async.apply(meta.sounds.init)
]);
plugins.fireHook('static:app.preload', {
app: app,
middleware: middleware
}, function(err) {
if (err) {
return winston.error('[plugins] Encountered error while executing pre-router plugins hooks: ' + err.message);
}
routes(app, middleware);
});
});
middleware = middleware(app);
routes(app, middleware);
plugins.init(app, middleware);
// Load server-side template helpers
helpers.register();