I have a simple function in a middleware that handles a scenario where a page cannot be found.
This function only requires the res
parameter to respond, it does not need the req
, res
and next
callback.
Is it okay to use Curley braces in the function – where I pass the parameter, so my code doesn’t need req
and next
?
I haven’t seen any examples like this, so unsure if there are issues.
function notFound ({ res }) {
res.sendStatus(404);
}