Express Routing - martinbalke-401-adavanced-js/seattle-javascript-401n14 GitHub Wiki
Express Routing
Express routing is a powerful tool to help you break up and modularize your code. A couple of the ways I see routes being most helpful are if you would like to run specific middleware just for one route. Say if you were going to authenticate on all of our /login/ routes.
Another way that I think routing can be very helpful is to break your code up into smaller more modular files. Say for instance you have a bunch of routes in your server that start with /puppies/, instead of having them clutter up your code and be less maintainable if you were to break them off in to puppies-routes.js and then app.use('/puppies', puppies); the code would be easier to understand, debug, and maintain.