Ghost/core/server/middleware/maintenance.js
Hannah Wolfe b0af496c98 💄 Ensure all middleware use named functions (#7434)
no issue

- anonymous functions are hard to debug in memory traces etc
- having anonymous middleware functions makes it hard to inspect or debug the middleware stack (something I like to do)
- these 2 are the only ones atm, including all 3rd party middleware
2016-09-26 11:10:44 +02:00

14 lines
332 B
JavaScript

var config = require('../config'),
i18n = require('../i18n'),
errors = require('../errors');
module.exports = function maintenance(req, res, next) {
if (config.get('maintenance').enabled) {
return next(new errors.Maintenance(
i18n.t('errors.general.maintenance')
));
}
next();
};