mirror of
https://github.com/taobataoma/meanTorrent.git
synced 2026-06-19 19:40:10 +02:00
Merge branch 'bugfix/404/#501' of https://github.com/dotch/mean-1 into error-404-pages
This commit is contained in:
@@ -177,7 +177,6 @@ module.exports.initModulesServerRoutes = function (app) {
|
||||
* Configure error handling
|
||||
*/
|
||||
module.exports.initErrorRoutes = function (app) {
|
||||
// Assume 'not found' in the error msgs is a 404. this is somewhat silly, but valid, you can do whatever you like, set properties, use instanceof etc.
|
||||
app.use(function (err, req, res, next) {
|
||||
// If the error object doesn't exists
|
||||
if (!err) return next();
|
||||
@@ -188,12 +187,6 @@ module.exports.initErrorRoutes = function (app) {
|
||||
// Redirect to error page
|
||||
res.redirect('/server-error');
|
||||
});
|
||||
|
||||
// Assume 404 since no middleware responded
|
||||
app.use(function (req, res) {
|
||||
// Redirect to not found page
|
||||
res.redirect('/not-found');
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -6,7 +6,9 @@ module.exports = function(app) {
|
||||
|
||||
// Define error pages
|
||||
app.route('/server-error').get(core.renderServerError);
|
||||
app.route('/not-found').get(core.renderNotFound);
|
||||
|
||||
// Return a 404 for all undefined api, module or lib routes
|
||||
app.route('/:url(api|modules|lib)/*').get(core.renderNotFound);
|
||||
|
||||
// Define application route
|
||||
app.route('/*').get(core.renderIndex);
|
||||
|
||||
Reference in New Issue
Block a user