Here's a straightforward query: What impact does returning a value in the express route request handler have?
I've observed various approaches when handling request responses:
route.get('/something', (req, res) => {
// blah blah
if (/* something */) {
return res.send('something'); // return on the same line
}
return res.send('something else');
});
Some developers perform an early return after sending a response:
route.get('/something', (req, res) => {
if (/* something */) {
res.send('something');
return; // return after
}
res.send('something else');
return;
});
Is there any distinguishable difference? Does the returned value serve any purpose?