Vote count:
0
I just learned that this is the way to try another route. Say for example you have a scenario where you have 3 'get' routes
app.get(/:customparam1, custom1);
app.get(/:customparam2, custom2);
app.get(/:customparam3, custom3);
And we have for each method something like:
custom# = function(req, res, next) {
req.collections.findOne({req.params}, function(err, coll) {
// do stuff here
})
}
My question is, does express try the routes in the order they are listed? If that is the case then, would I be correct in saying we want to write next('route') in custom1 and and custom2 route methods but not in custom3 since that would be the final route that is checked?
asked 1 min ago
Express JS next('route')
Aucun commentaire:
Enregistrer un commentaire