mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-03-05 20:11:26 +01:00
fixed #1274
This commit is contained in:
@@ -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;
|
||||
Reference in New Issue
Block a user