moved action:app.load out of webserver; passing in app, mdw, and controllers into action:app.load. now we can create routes dynamically ;)

v1.18.x
psychobunny 11 years ago
parent a9cccc9b9c
commit 178edd150a

@ -3,8 +3,8 @@
var nconf = require('nconf'),
controllers = require('./../controllers'),
meta = require('./../meta'),
plugins = require('./../plugins'),
metaRoutes = require('./meta'),
apiRoutes = require('./api'),
adminRoutes = require('./admin'),
@ -122,6 +122,7 @@ module.exports = function(app, middleware) {
app.get('/api/users/search', middleware.checkGlobalPrivacySettings, controllers.users.getUsersForSearch);
pluginRoutes(app, middleware, controllers);
plugins.fireHook('action:app.load', app, middleware, controllers);
if (process.env.NODE_ENV === 'development') {
require('./debug')(app, middleware, controllers);

@ -22,7 +22,7 @@ function setupPluginRoutes(app) {
/*
* TO BE DEPRECATED post 0.4x and replaced with something that isn't as complicated as this...
*/
plugins.fireHook('filter:server.create_routes', custom_routes, function(err, custom_routes) {
/*plugins.fireHook('filter:server.create_routes', custom_routes, function(err, custom_routes) {
var route,
routes = custom_routes.routes;
@ -33,12 +33,12 @@ function setupPluginRoutes(app) {
(function(route) {
app[routes[route].method || 'get'](routes[route].route, function(req, res) {
routes[route].options(req, res, function(options) {
/*app.build_header({
app.build_header({
req: options.req || req,
res: options.res || res
}, function (err, header) {
//res.send(header + options.content + templates.footer);
});*/
});
});
});
}(route));
@ -68,7 +68,7 @@ function setupPluginRoutes(app) {
}(route));
}
}
});
});*/
});
}
@ -82,7 +82,7 @@ function setupPluginAdminRoutes(app) {
/*
* TO BE DEPRECATED post 0.4x and replaced with something that isn't as complicated as this...
*/
plugins.fireHook('filter:admin.create_routes', custom_routes, function(err, custom_routes) {
/*plugins.fireHook('filter:admin.create_routes', custom_routes, function(err, custom_routes) {
var route, routes = custom_routes.routes;
for (route in routes) {
@ -90,9 +90,9 @@ function setupPluginAdminRoutes(app) {
(function(route) {
app[routes[route].method || 'get']('/admin' + routes[route].route, function(req, res) {
routes[route].options(req, res, function(options) {
//Admin.buildHeader(req, res, function (err, header) {
//res.send(header + options.content + templates['admin/footer']);
//});
Admin.buildHeader(req, res, function (err, header) {
res.send(header + options.content + templates['admin/footer']);
});
});
});
}(route));
@ -111,7 +111,7 @@ function setupPluginAdminRoutes(app) {
}(route));
}
}
});
});*/
});
}

@ -11,7 +11,6 @@ var path = require('path'),
db = require('./database'),
auth = require('./routes/authentication'),
meta = require('./meta'),
plugins = require('./plugins'),
logger = require('./logger'),
middleware = require('./middleware'),
routes = require('./routes');
@ -82,8 +81,6 @@ if(nconf.get('ssl')) {
module.exports.server = server;
module.exports.init = function () {
plugins.fireHook('action:app.load', app);
server.on("error", function(err){
if (err.code === 'EADDRINUSE') {
winston.error('NodeBB address in use, exiting...');

Loading…
Cancel
Save