You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
410 B
JavaScript
24 lines
410 B
JavaScript
"use strict";
|
|
|
|
var staticController = {};
|
|
|
|
createStatic('404');
|
|
createStatic('403');
|
|
createStatic('500');
|
|
|
|
function createStatic(statusCode) {
|
|
staticController[statusCode] = function(req, res) {
|
|
if (!res.locals.isAPI) {
|
|
res.statusCode = parseInt(statusCode, 10);
|
|
}
|
|
|
|
res.render(statusCode, {
|
|
errorMessage: req.flash('errorMessage')[0] || undefined
|
|
});
|
|
};
|
|
}
|
|
|
|
module.exports = staticController;
|
|
|
|
|