node.js - nodejs / express: does calling next() automatically return the function it is called from? -
just wanted out of head:
when dealing routing in express/ nodejs want know if calling next() returns function called from? consider:
app.get('/users/:id?', function(req, res, next){ //just as example var err = dovalidation(req); if (err) { next(err); } next(); //will ever called? }); in case of error, second next() ever called, or call first next(err) (automagically) return function called from?
yes, if error, both called. want do:
if(err) { return next(err); }
Comments
Post a Comment