In Nodejs, for every api i am using try/catch block, if everything works i return the response with 200 and in catch block i need to use the
is there any way i can avoid using
try/catch like if anything fails, some middleware or anything can catch the error and send the error response to user.
Like in NestJS you just simply use the return response, no need to even use
res.send to send the response, if there is error it automatically send the 500 response
This question is not yet answered, be the first one who answer using the comment. Later the confirmed answer will be published as the solution.