Express Routing - 401-advanced-javascript-davetrost/alchemy-fsjs-fall-2019 GitHub Wiki
Express Routing
Reading materials
Overview
It seems that routes in Express are a new(er) thing and that they represent a nice improvement from the previous way of doing things. With the context I have today, I'm not sure I see much difference.
Using the ExpressJS 4.0 Router from scotch.io
Some benefits that can be realized by using Routes. Most of these benefits are for organizational purposes:
express.Router()can be called multiple times to define groups of routes.- The
app.route()is a shortcut to define multiple requests on a route - And, the express.Router() can be applied to a whole section of a site using
app.use()
Routing on ExpressJS.com
Routing passes a client's request from the URL to the server-side handler.
Route paths have some powerful features:
- URL path matching can be done by strings (standard) or by string patterns or by regular expressions
- Route handlers can be stacked. They can be listed as multiple arguments and/or provided in an array structure.
- route handlers can be specified in a modular chain, as applicable to a single path. This reduces code redundancy.