Answer the question
In order to leave comments, you need to log in
Routing, or to whom does next pass control?
Good day, colleagues.
With such routing, everything is clear -
app.get('/', middleWare, function (req, res) {
res.render('index', { s: 'hello' });
});
'someMiddlewareFunction': function (errfunc) {
return function (req, res, next) {
// .. code
if (someFlag) {
errfunc(global.ERR_AUTH_NOT_LOGGED_IN, req, res);
}
else {
next();
}
// .. code
}
app.get( '/users/:id([0-9]+)', function (req, res, next) {
if (id > 10) {
// .. some code
}
else {
next('ERROR');
}
});
Answer the question
In order to leave comments, you need to log in
github.com/visionmedia/express/blob/master/examples/error-pages/index.js
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question