simpler static

v1.18.x
barisusakli 11 years ago
parent 824d849a52
commit 0e5c65199d

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

Loading…
Cancel
Save