2013-11-26 00:31:18 +04:00
|
|
|
// # Custom Middleware
|
|
|
|
// The following custom middleware functions cannot yet be unit tested, and as such are kept separate from
|
|
|
|
// the testable custom middleware functions in middleware.js
|
|
|
|
|
2014-07-28 17:19:49 +04:00
|
|
|
var api = require('../api'),
|
|
|
|
bodyParser = require('body-parser'),
|
|
|
|
config = require('../config'),
|
|
|
|
errors = require('../errors'),
|
|
|
|
express = require('express'),
|
|
|
|
favicon = require('static-favicon'),
|
|
|
|
fs = require('fs'),
|
|
|
|
hbs = require('express-hbs'),
|
|
|
|
logger = require('morgan'),
|
|
|
|
middleware = require('./middleware'),
|
|
|
|
packageInfo = require('../../../package.json'),
|
|
|
|
path = require('path'),
|
|
|
|
routes = require('../routes'),
|
|
|
|
slashes = require('connect-slashes'),
|
|
|
|
storage = require('../storage'),
|
|
|
|
url = require('url'),
|
|
|
|
_ = require('lodash'),
|
|
|
|
passport = require('passport'),
|
|
|
|
oauth = require('./oauth'),
|
|
|
|
oauth2orize = require('oauth2orize'),
|
2014-06-30 16:58:10 +04:00
|
|
|
authStrategies = require('./authStrategies'),
|
2014-07-28 17:19:49 +04:00
|
|
|
utils = require('../utils'),
|
2013-11-12 10:03:25 +04:00
|
|
|
|
2013-12-31 03:13:25 +04:00
|
|
|
expressServer,
|
2014-07-28 17:19:49 +04:00
|
|
|
setupMiddleware;
|
2013-11-12 10:03:25 +04:00
|
|
|
|
|
|
|
// ##Custom Middleware
|
|
|
|
|
|
|
|
// ### GhostLocals Middleware
|
|
|
|
// Expose the standard locals that every external page should have available,
|
|
|
|
// separating between the theme and the admin
|
|
|
|
function ghostLocals(req, res, next) {
|
|
|
|
// Make sure we have a locals value.
|
|
|
|
res.locals = res.locals || {};
|
|
|
|
res.locals.version = packageInfo.version;
|
2014-01-03 04:37:21 +04:00
|
|
|
// relative path from the URL, not including subdir
|
2014-07-17 18:33:21 +04:00
|
|
|
res.locals.relativeUrl = req.path.replace(config.paths.subdir, '');
|
2013-11-12 10:03:25 +04:00
|
|
|
|
2014-06-30 16:58:10 +04:00
|
|
|
next();
|
2013-11-12 10:03:25 +04:00
|
|
|
}
|
|
|
|
|
2014-02-22 05:25:31 +04:00
|
|
|
function initThemeData(secure) {
|
|
|
|
var themeConfig = config.theme();
|
2014-07-17 18:33:21 +04:00
|
|
|
if (secure && config.urlSSL) {
|
2014-02-22 05:25:31 +04:00
|
|
|
// For secure requests override .url property with the SSL version
|
|
|
|
themeConfig = _.clone(themeConfig);
|
2014-07-17 18:33:21 +04:00
|
|
|
themeConfig.url = config.urlSSL.replace(/\/$/, '');
|
2014-02-22 05:25:31 +04:00
|
|
|
}
|
|
|
|
return themeConfig;
|
|
|
|
}
|
|
|
|
|
2013-11-12 10:03:25 +04:00
|
|
|
// ### Activate Theme
|
|
|
|
// Helper for manageAdminAndTheme
|
2013-12-06 12:51:35 +04:00
|
|
|
function activateTheme(activeTheme) {
|
2013-12-02 03:31:55 +04:00
|
|
|
var hbsOptions,
|
2014-07-17 18:33:21 +04:00
|
|
|
themePartials = path.join(config.paths.themePath, activeTheme, 'partials');
|
2013-11-12 10:03:25 +04:00
|
|
|
|
|
|
|
// clear the view cache
|
2013-12-06 18:13:15 +04:00
|
|
|
expressServer.cache = {};
|
2013-11-12 10:03:25 +04:00
|
|
|
|
2013-12-02 03:31:55 +04:00
|
|
|
// set view engine
|
2014-07-17 18:33:21 +04:00
|
|
|
hbsOptions = { partialsDir: [ config.paths.helperTemplates ] };
|
2014-01-14 03:11:59 +04:00
|
|
|
|
|
|
|
fs.stat(themePartials, function (err, stats) {
|
2013-12-02 03:31:55 +04:00
|
|
|
// Check that the theme has a partials directory before trying to use it
|
2014-01-14 03:11:59 +04:00
|
|
|
if (!err && stats && stats.isDirectory()) {
|
|
|
|
hbsOptions.partialsDir.push(themePartials);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2013-12-02 03:31:55 +04:00
|
|
|
expressServer.set('theme view engine', hbs.express3(hbsOptions));
|
|
|
|
|
2013-11-12 10:03:25 +04:00
|
|
|
// Update user error template
|
2014-03-27 00:43:16 +04:00
|
|
|
errors.updateActiveTheme(activeTheme);
|
2014-04-12 07:46:15 +04:00
|
|
|
|
|
|
|
// Set active theme variable on the express server
|
|
|
|
expressServer.set('activeTheme', activeTheme);
|
2013-11-12 10:03:25 +04:00
|
|
|
}
|
2014-08-08 20:17:07 +04:00
|
|
|
// ### decideIsAdmin Middleware
|
2013-11-12 10:03:25 +04:00
|
|
|
// Uses the URL to detect whether this response should be an admin response
|
|
|
|
// This is used to ensure the right content is served, and is not for security purposes
|
2014-08-08 20:17:07 +04:00
|
|
|
function decideIsAdmin(req, res, next) {
|
2014-07-17 18:33:21 +04:00
|
|
|
res.isAdmin = req.url.lastIndexOf(config.paths.subdir + '/ghost/', 0) === 0;
|
2014-08-08 20:17:07 +04:00
|
|
|
next();
|
|
|
|
}
|
2013-11-17 22:40:26 +04:00
|
|
|
|
2014-08-08 20:17:07 +04:00
|
|
|
// ### configHbsForContext Middleware
|
|
|
|
// Setup handlebars for the current context (admin or theme)
|
|
|
|
function configHbsForContext(req, res, next) {
|
2013-11-12 10:03:25 +04:00
|
|
|
if (res.isAdmin) {
|
2013-12-06 18:13:15 +04:00
|
|
|
expressServer.enable('admin');
|
2014-04-12 07:46:15 +04:00
|
|
|
expressServer.engine('hbs', expressServer.get('admin view engine'));
|
2014-07-17 18:33:21 +04:00
|
|
|
expressServer.set('views', config.paths.adminViews);
|
2013-11-12 10:03:25 +04:00
|
|
|
} else {
|
2013-12-06 18:13:15 +04:00
|
|
|
expressServer.disable('admin');
|
2014-04-12 07:46:15 +04:00
|
|
|
var themeData = initThemeData(req.secure);
|
|
|
|
hbs.updateTemplateOptions({ data: {blog: themeData} });
|
|
|
|
expressServer.engine('hbs', expressServer.get('theme view engine'));
|
2014-07-17 18:33:21 +04:00
|
|
|
expressServer.set('views', path.join(config.paths.themePath, expressServer.get('activeTheme')));
|
2013-11-12 10:03:25 +04:00
|
|
|
}
|
2014-04-12 07:46:15 +04:00
|
|
|
|
|
|
|
// Pass 'secure' flag to the view engine
|
|
|
|
// so that templates can choose 'url' vs 'urlSSL'
|
|
|
|
res.locals.secure = req.secure;
|
|
|
|
|
|
|
|
next();
|
|
|
|
}
|
|
|
|
|
|
|
|
// ### updateActiveTheme
|
|
|
|
// Updates the expressServer's activeTheme variable and subsequently
|
|
|
|
// activates that theme's views with the hbs templating engine if it
|
|
|
|
// is not yet activated.
|
|
|
|
function updateActiveTheme(req, res, next) {
|
Refactor API arguments
closes #2610, refs #2697
- cleanup API index.js, and add docs
- all API methods take consistent arguments: object & options
- browse, read, destroy take options, edit and add take object and options
- the context is passed as part of options, meaning no more .call
everywhere
- destroy expects an object, rather than an id all the way down to the model layer
- route params such as :id, :slug, and :key are passed as an option & used
to perform reads, updates and deletes where possible - settings / themes
may need work here still
- HTTP posts api can find a post by slug
- Add API utils for checkData
2014-05-08 16:41:19 +04:00
|
|
|
api.settings.read({context: {internal: true}, key: 'activeTheme'}).then(function (response) {
|
2014-04-28 03:28:50 +04:00
|
|
|
var activeTheme = response.settings[0];
|
2013-12-06 12:51:35 +04:00
|
|
|
// Check if the theme changed
|
2013-12-06 18:13:15 +04:00
|
|
|
if (activeTheme.value !== expressServer.get('activeTheme')) {
|
2013-12-06 12:51:35 +04:00
|
|
|
// Change theme
|
2014-07-17 18:33:21 +04:00
|
|
|
if (!config.paths.availableThemes.hasOwnProperty(activeTheme.value)) {
|
2013-12-06 12:51:35 +04:00
|
|
|
if (!res.isAdmin) {
|
|
|
|
// Throw an error if the theme is not available, but not on the admin UI
|
2014-01-25 02:14:56 +04:00
|
|
|
return errors.throwError('The currently active theme ' + activeTheme.value + ' is missing.');
|
2013-12-06 12:51:35 +04:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
activateTheme(activeTheme.value);
|
2013-11-12 10:03:25 +04:00
|
|
|
}
|
|
|
|
}
|
2013-12-06 12:51:35 +04:00
|
|
|
next();
|
2014-08-17 10:17:23 +04:00
|
|
|
}).catch(function (err) {
|
2014-01-25 02:14:56 +04:00
|
|
|
// Trying to start up without the active theme present, setup a simple hbs instance
|
|
|
|
// and render an error page straight away.
|
|
|
|
expressServer.engine('hbs', hbs.express3());
|
|
|
|
next(err);
|
2013-12-06 12:51:35 +04:00
|
|
|
});
|
2013-11-12 10:03:25 +04:00
|
|
|
}
|
|
|
|
|
2014-06-25 16:12:48 +04:00
|
|
|
// Redirect to setup if no user exists
|
|
|
|
function redirectToSetup(req, res, next) {
|
|
|
|
/*jslint unparam:true*/
|
|
|
|
|
2014-07-11 16:17:09 +04:00
|
|
|
api.authentication.isSetup().then(function (exists) {
|
|
|
|
if (!exists.setup[0].status && !req.path.match(/\/ghost\/setup\//)) {
|
2014-07-17 18:33:21 +04:00
|
|
|
return res.redirect(config.paths.subdir + '/ghost/setup/');
|
2014-06-25 16:12:48 +04:00
|
|
|
}
|
|
|
|
next();
|
2014-08-17 10:17:23 +04:00
|
|
|
}).catch(function (err) {
|
2014-06-25 16:12:48 +04:00
|
|
|
return next(new Error(err));
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2014-08-23 20:23:34 +04:00
|
|
|
// Detect uppercase in req.path
|
|
|
|
function uncapitalise(req, res, next) {
|
2014-08-27 01:07:03 +04:00
|
|
|
var pathToTest = req.path,
|
2014-08-29 23:48:58 +04:00
|
|
|
isSignupOrReset = req.path.match(/(\/ghost\/(signup|reset)\/)/i),
|
|
|
|
isAPI = req.path.match(/(\/ghost\/api\/v0[\d\.]+\/.*?\/)/i);
|
2014-08-27 01:07:03 +04:00
|
|
|
|
|
|
|
if (isSignupOrReset) {
|
|
|
|
pathToTest = isSignupOrReset[1];
|
|
|
|
}
|
2014-08-29 23:48:58 +04:00
|
|
|
|
|
|
|
// Do not lowercase anything after /api/v0.1/ to protect :key/:slug
|
|
|
|
if (isAPI) {
|
|
|
|
pathToTest = isAPI[1];
|
|
|
|
}
|
2014-08-27 01:07:03 +04:00
|
|
|
|
|
|
|
if (/[A-Z]/.test(pathToTest)) {
|
2014-08-23 20:23:34 +04:00
|
|
|
res.set('Cache-Control', 'public, max-age=' + utils.ONE_YEAR_S);
|
2014-08-27 01:07:03 +04:00
|
|
|
res.redirect(301, req.url.replace(pathToTest, pathToTest.toLowerCase()));
|
2014-08-23 20:23:34 +04:00
|
|
|
} else {
|
|
|
|
next();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-12-19 20:05:45 +04:00
|
|
|
function isSSLrequired(isAdmin) {
|
2014-07-17 18:33:21 +04:00
|
|
|
var forceSSL = url.parse(config.url).protocol === 'https:' ? true : false,
|
|
|
|
forceAdminSSL = (isAdmin && config.forceAdminSSL);
|
2013-12-19 20:05:45 +04:00
|
|
|
if (forceSSL || forceAdminSSL) {
|
|
|
|
return true;
|
2013-12-09 23:41:19 +04:00
|
|
|
}
|
2013-12-19 20:05:45 +04:00
|
|
|
return false;
|
2013-12-09 23:41:19 +04:00
|
|
|
}
|
|
|
|
|
2013-12-19 20:05:45 +04:00
|
|
|
// Check to see if we should use SSL
|
|
|
|
// and redirect if needed
|
2013-12-09 23:41:19 +04:00
|
|
|
function checkSSL(req, res, next) {
|
2013-12-19 20:05:45 +04:00
|
|
|
if (isSSLrequired(res.isAdmin)) {
|
2014-01-27 02:00:50 +04:00
|
|
|
if (!req.secure) {
|
2014-07-17 18:33:21 +04:00
|
|
|
var forceAdminSSL = config.forceAdminSSL,
|
2014-02-22 05:25:31 +04:00
|
|
|
redirectUrl;
|
|
|
|
|
|
|
|
// Check if forceAdminSSL: { redirect: false } is set, which means
|
|
|
|
// we should just deny non-SSL access rather than redirect
|
|
|
|
if (forceAdminSSL && forceAdminSSL.redirect !== undefined && !forceAdminSSL.redirect) {
|
2014-08-09 17:48:58 +04:00
|
|
|
return res.status(403).end();
|
2014-02-22 05:25:31 +04:00
|
|
|
}
|
|
|
|
|
2014-07-17 18:33:21 +04:00
|
|
|
redirectUrl = url.parse(config.urlSSL || config.url);
|
2013-12-19 20:05:45 +04:00
|
|
|
return res.redirect(301, url.format({
|
|
|
|
protocol: 'https:',
|
2014-02-22 05:25:31 +04:00
|
|
|
hostname: redirectUrl.hostname,
|
|
|
|
port: redirectUrl.port,
|
2013-12-19 20:05:45 +04:00
|
|
|
pathname: req.path,
|
|
|
|
query: req.query
|
|
|
|
}));
|
|
|
|
}
|
2013-12-09 23:41:19 +04:00
|
|
|
}
|
|
|
|
next();
|
|
|
|
}
|
|
|
|
|
2014-03-09 13:28:58 +04:00
|
|
|
// ### Robots Middleware
|
|
|
|
// Handle requests to robots.txt and cache file
|
|
|
|
function robots() {
|
|
|
|
var content, // file cache
|
2014-07-17 18:33:21 +04:00
|
|
|
filePath = path.join(config.paths.corePath, '/shared/robots.txt');
|
2014-03-09 13:28:58 +04:00
|
|
|
|
|
|
|
return function robots(req, res, next) {
|
|
|
|
if ('/robots.txt' === req.url) {
|
|
|
|
if (content) {
|
|
|
|
res.writeHead(200, content.headers);
|
|
|
|
res.end(content.body);
|
|
|
|
} else {
|
|
|
|
fs.readFile(filePath, function (err, buf) {
|
|
|
|
if (err) {
|
|
|
|
return next(err);
|
|
|
|
}
|
2014-04-29 00:42:38 +04:00
|
|
|
|
2014-03-09 13:28:58 +04:00
|
|
|
content = {
|
|
|
|
headers: {
|
|
|
|
'Content-Type': 'text/plain',
|
|
|
|
'Content-Length': buf.length,
|
2014-07-28 17:19:49 +04:00
|
|
|
'Cache-Control': 'public, max-age=' + utils.ONE_YEAR_S
|
2014-03-09 13:28:58 +04:00
|
|
|
},
|
|
|
|
body: buf
|
|
|
|
};
|
|
|
|
res.writeHead(200, content.headers);
|
|
|
|
res.end(content.body);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
next();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2014-07-14 16:29:45 +04:00
|
|
|
setupMiddleware = function (server) {
|
2014-07-17 18:33:21 +04:00
|
|
|
var logging = config.logging,
|
|
|
|
subdir = config.paths.subdir,
|
|
|
|
corePath = config.paths.corePath,
|
2014-06-30 16:58:10 +04:00
|
|
|
oauthServer = oauth2orize.createServer();
|
|
|
|
|
|
|
|
// silence JSHint without disabling unused check for the whole file
|
|
|
|
authStrategies = authStrategies;
|
2013-11-12 10:03:25 +04:00
|
|
|
|
2013-12-06 18:13:15 +04:00
|
|
|
// Cache express server instance
|
|
|
|
expressServer = server;
|
|
|
|
middleware.cacheServer(expressServer);
|
2014-06-30 16:58:10 +04:00
|
|
|
middleware.cacheOauthServer(oauthServer);
|
2014-08-05 14:58:58 +04:00
|
|
|
oauth.init(oauthServer, middleware.resetSpamCounter);
|
2013-12-06 18:13:15 +04:00
|
|
|
|
2014-01-27 02:00:50 +04:00
|
|
|
// Make sure 'req.secure' is valid for proxied requests
|
|
|
|
// (X-Forwarded-Proto header will be checked, if present)
|
|
|
|
expressServer.enable('trust proxy');
|
|
|
|
|
2013-11-12 10:03:25 +04:00
|
|
|
// Logging configuration
|
2014-02-11 01:07:11 +04:00
|
|
|
if (logging !== false) {
|
|
|
|
if (expressServer.get('env') !== 'development') {
|
2014-04-12 07:46:15 +04:00
|
|
|
expressServer.use(logger(logging || {}));
|
2014-02-11 01:07:11 +04:00
|
|
|
} else {
|
2014-04-12 07:46:15 +04:00
|
|
|
expressServer.use(logger(logging || 'dev'));
|
2014-02-11 01:07:11 +04:00
|
|
|
}
|
2013-11-12 10:03:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// Favicon
|
2014-04-12 07:46:15 +04:00
|
|
|
expressServer.use(subdir, favicon(corePath + '/shared/favicon.ico'));
|
2013-11-12 10:03:25 +04:00
|
|
|
|
2013-12-31 03:13:25 +04:00
|
|
|
// Static assets
|
2014-07-28 17:19:49 +04:00
|
|
|
expressServer.use(subdir + '/shared', express['static'](path.join(corePath, '/shared'), {maxAge: utils.ONE_HOUR_MS}));
|
2013-12-28 20:01:08 +04:00
|
|
|
expressServer.use(subdir + '/content/images', storage.get_storage().serve());
|
2014-07-28 17:19:49 +04:00
|
|
|
expressServer.use(subdir + '/ghost/scripts', express['static'](path.join(corePath, '/built/scripts'), {maxAge: utils.ONE_YEAR_MS}));
|
|
|
|
expressServer.use(subdir + '/public', express['static'](path.join(corePath, '/built/public'), {maxAge: utils.ONE_YEAR_MS}));
|
2013-11-12 10:03:25 +04:00
|
|
|
|
|
|
|
// First determine whether we're serving admin or theme content
|
2014-08-08 20:17:07 +04:00
|
|
|
expressServer.use(decideIsAdmin);
|
2014-04-12 07:46:15 +04:00
|
|
|
expressServer.use(updateActiveTheme);
|
2014-08-08 20:17:07 +04:00
|
|
|
expressServer.use(configHbsForContext);
|
2013-11-12 10:03:25 +04:00
|
|
|
|
|
|
|
// Admin only config
|
2014-07-28 17:19:49 +04:00
|
|
|
expressServer.use(subdir + '/ghost', middleware.whenEnabled('admin', express['static'](path.join(corePath, '/client/assets'), {maxAge: utils.ONE_YEAR_MS})));
|
2013-11-12 10:03:25 +04:00
|
|
|
|
2014-01-27 02:21:24 +04:00
|
|
|
// Force SSL
|
|
|
|
// NOTE: Importantly this is _after_ the check above for admin-theme static resources,
|
|
|
|
// which do not need HTTPS. In fact, if HTTPS is forced on them, then 404 page might
|
|
|
|
// not display properly when HTTPS is not available!
|
|
|
|
expressServer.use(checkSSL);
|
|
|
|
|
2013-11-12 10:03:25 +04:00
|
|
|
// Theme only config
|
2014-04-12 07:46:15 +04:00
|
|
|
expressServer.use(subdir, middleware.staticTheme());
|
2013-11-12 10:03:25 +04:00
|
|
|
|
2014-03-09 13:28:58 +04:00
|
|
|
// Serve robots.txt if not found in theme
|
|
|
|
expressServer.use(robots());
|
|
|
|
|
2014-08-23 20:23:34 +04:00
|
|
|
// Handle trailing slashes and capitalization of routes
|
2014-07-28 17:19:49 +04:00
|
|
|
expressServer.use(slashes(true, {headers: {'Cache-Control': 'public, max-age=' + utils.ONE_YEAR_S}}));
|
2014-08-23 20:23:34 +04:00
|
|
|
expressServer.use(uncapitalise);
|
2013-11-12 10:03:25 +04:00
|
|
|
|
2013-12-31 03:13:25 +04:00
|
|
|
// Body parsing
|
2014-04-12 07:46:15 +04:00
|
|
|
expressServer.use(bodyParser.json());
|
2014-08-09 17:48:58 +04:00
|
|
|
expressServer.use(bodyParser.urlencoded({ extended: true }));
|
2013-11-17 22:40:26 +04:00
|
|
|
|
2014-06-30 16:58:10 +04:00
|
|
|
expressServer.use(passport.initialize());
|
2013-11-12 10:03:25 +04:00
|
|
|
|
2014-02-14 14:00:11 +04:00
|
|
|
// ### Caching
|
|
|
|
expressServer.use(middleware.cacheControl('public'));
|
2014-02-20 02:53:40 +04:00
|
|
|
expressServer.use(subdir + '/ghost/', middleware.cacheControl('private'));
|
2014-02-14 14:00:11 +04:00
|
|
|
|
2014-04-29 00:58:18 +04:00
|
|
|
|
2014-06-30 16:58:10 +04:00
|
|
|
// enable authentication
|
2014-02-14 14:00:11 +04:00
|
|
|
expressServer.use(middleware.authenticate);
|
|
|
|
|
2013-11-12 10:03:25 +04:00
|
|
|
// local data
|
2013-12-06 18:13:15 +04:00
|
|
|
expressServer.use(ghostLocals);
|
2014-04-29 00:58:18 +04:00
|
|
|
|
2013-12-31 03:13:25 +04:00
|
|
|
// ### Routing
|
2014-04-12 07:46:15 +04:00
|
|
|
// Set up API routes
|
2014-07-09 02:28:31 +04:00
|
|
|
expressServer.use(subdir + routes.apiBaseUri, routes.api(middleware));
|
2014-04-12 07:46:15 +04:00
|
|
|
|
|
|
|
// Set up Admin routes
|
|
|
|
expressServer.use(subdir, routes.admin(middleware));
|
|
|
|
|
|
|
|
// Set up Frontend routes
|
|
|
|
expressServer.use(subdir, routes.frontend());
|
2013-11-12 10:03:25 +04:00
|
|
|
|
|
|
|
// ### Error handling
|
|
|
|
// 404 Handler
|
2013-12-06 18:13:15 +04:00
|
|
|
expressServer.use(errors.error404);
|
2013-11-12 10:03:25 +04:00
|
|
|
|
|
|
|
// 500 Handler
|
2013-12-06 18:13:15 +04:00
|
|
|
expressServer.use(errors.error500);
|
2013-11-12 10:03:25 +04:00
|
|
|
};
|
|
|
|
|
2014-07-14 16:29:45 +04:00
|
|
|
module.exports = setupMiddleware;
|
2013-11-12 10:03:25 +04:00
|
|
|
// Export middleware functions directly
|
2013-11-17 22:40:26 +04:00
|
|
|
module.exports.middleware = middleware;
|
2013-12-06 18:13:15 +04:00
|
|
|
// Expose middleware functions in this file as well
|
2014-06-25 16:12:48 +04:00
|
|
|
module.exports.middleware.redirectToSetup = redirectToSetup;
|