Currently, I am testing My node js code enter image description here
This is one of my routes something bad happens it will catch the error and pass it to the middleware enter image description here
This is my middleware which is sending a response of 500 with a text enter image description here
After then I imported my middleware into the index.js app.use it after all the routes enter image description here
after I execute my code successfully
so to test it this catch block is working or not I stopped the server of MongoDB by "net stop MongoDB" after then I went to the postman to send a request to that endpoint.
Which keep loading and not sending response even after 10 mins
and got this on the CMD enter image description here
Note: My code is working properly when I starts my MongoDb server