Understanding routes
In Chapter 1, Getting Ready, we acknowledged the fact that the ASP.NET Core pipeline has been completely rewritten in order to merge the MVC and WebAPI modules into a single, lightweight framework to handle both worlds. Although this is certainly a good thing, it comes with the usual downside that we need to learn a lot of new stuff. Handling routes is a perfect example of this, as the new approach defines some major breaking changes from the past.
Defining routing
The first thing we should do is to give out a proper definition of what routing actually is.
To cut it simple, we can say that URL routing is the server-side feature that allows a web developer to handle HTTP requests pointing to URIs not mapping to physical files. Such a technique can be used for a number of different reasons, including these:
- Giving dynamic pages semantic, meaningful, and human-readable names in order to advantage readability and/or Search Engine Optimization (SEO)
- Renaming or moving one or more...