Relative Content

Tag Archive for node.jsmongodbexpressmongoose

Express: Why is the last middleware always being called?

I’m making my first MERN app and I’m encountering an issue with my middleware. The last middleware catchError is always being called, and it’s returning a 500 Internal Server Error response (which I defined) with the error message “User not found”. I can’t figure out why this is happening. Here’s a short version of the server.ts file: