I am using Restify with Nodejs and I have a question on the correct way of returning control to the next middleware in stack. I hope I am using the correct phrase when I say "next middleware in stack".
Basically, my code looks like this:
//server is the server created using Restify
server.use(function (req, res, next) {
//if some checks are a success
return next();
});
Now, what I wish to know is should the code be return next();
or should it be just next();
to pass control to the next in stack?
I checked and both work - that is both pieces of code will successfully pass control and return the data as expected - what I wish to know is if there is a difference between the two and if I need to use one over another.
What doing next callback in http handlers? server.get('/', function(req,res,next){res.end();})
Should I to call next too? – Discomfit