moved setupPageRoute to helpers

v1.18.x
Barış Soner Uşaklı 10 years ago
parent 8c79e11dae
commit ac1e0513fc

@ -0,0 +1,12 @@
'use strict';
var helpers = {};
helpers.setupPageRoute = function(router, name, middleware, middlewares, controller) {
middlewares = middlewares.concat([middleware.pageView]);
router.get(name, middleware.buildHeader, middlewares, controller);
router.get('/api' + name, middlewares, controller);
};
module.exports = helpers;

@ -13,9 +13,10 @@ var nconf = require('nconf'),
adminRoutes = require('./admin'),
feedRoutes = require('./feeds'),
pluginRoutes = require('./plugins'),
authRoutes = require('./authentication');
authRoutes = require('./authentication'),
helpers = require('./helpers');
var setupPageRoute = helpers.setupPageRoute;
function mainRoutes(app, middleware, controllers) {
setupPageRoute(app, '/', middleware, [], controllers.home);
@ -99,13 +100,6 @@ function groupRoutes(app, middleware, controllers) {
setupPageRoute(app, '/groups/:slug/members', middleware, middlewares, controllers.groups.members);
}
function setupPageRoute(router, name, middleware, middlewares, controller) {
middlewares = middlewares.concat([middleware.pageView]);
router.get(name, middleware.buildHeader, middlewares, controller);
router.get('/api' + name, middlewares, controller);
}
module.exports = function(app, middleware) {
var router = express.Router(),
pluginRouter = express.Router(),

Loading…
Cancel
Save