|
|
|
@ -2,28 +2,24 @@
|
|
|
|
|
|
|
|
|
|
var staticController = {};
|
|
|
|
|
|
|
|
|
|
staticController['404'] = function(req, res, next) {
|
|
|
|
|
if (!res.locals.isAPI) {
|
|
|
|
|
res.statusCode = 404;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
res.render('404', {});
|
|
|
|
|
staticController['404'] = function(req, res) {
|
|
|
|
|
renderStatic(404, req, res);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
staticController['403'] = function(req, res, next) {
|
|
|
|
|
if (!res.locals.isAPI) {
|
|
|
|
|
res.statusCode = 403;
|
|
|
|
|
}
|
|
|
|
|
staticController['403'] = function(req, res) {
|
|
|
|
|
renderStatic(403, req, res);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
res.render('403', {});
|
|
|
|
|
staticController['500'] = function(req, res) {
|
|
|
|
|
renderStatic(500, req, res);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
staticController['500'] = function(req, res, next) {
|
|
|
|
|
function renderStatic(statusCode, req, res) {
|
|
|
|
|
if (!res.locals.isAPI) {
|
|
|
|
|
res.statusCode = 500;
|
|
|
|
|
res.statusCode = statusCode;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
res.render('500', {});
|
|
|
|
|
};
|
|
|
|
|
res.render(statusCode.toString(), {});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
module.exports = staticController;
|