I want to use express.Router in my app. I have a file index file that runs the server. And a file routes that run some express routes, thanks to express.Router.
What I want that, whenever one of my route fails, the error middleware defined in index is reached;
In the example above: - when I use the route ok, it works - when I use the route no ok, the error is thrown without reaching the error middleware.
Do you know how to achieve it ?
Thank you !
https://gist.github.com/VivienAdnot/e3cf44de745531c6cca7be5de53c341a