v1.18.x
Julian Lam 11 years ago
parent 4f88e9cf2c
commit 585eb9e1be

@ -1,17 +1,32 @@
"use strict";
var staticController = {};
var staticController = {},
isApi = function(path) {
return !!path.match('api');
};
staticController['404'] = function(req, res, next) {
res.status(404).render('404', {});
if (!isApi(req.path)) {
res.statusCode = 404;
}
res.render('404', {});
};
staticController['403'] = function(req, res, next) {
res.status(403).render('403', {});
if (!isApi(req.path)) {
res.statusCode = 403;
}
res.render('403', {});
};
staticController['500'] = function(req, res, next) {
res.status(500).render('500', {});
if (!isApi(req.path)) {
res.statusCode = 500;
}
res.render('500', {});
};
module.exports = staticController;
Loading…
Cancel
Save