Express return not required. next(error) is enough for him.
function foo(req, res, next) { next(new Error()); }
But return can also be used to stop the execution of the current function , allowing next(error) more closely resemble the throw statement.
function foo(req, res, next) { return next(new Error()); console.log("This is unreachable code and won't be logged."); }
Jonathan lonowski
source share