In the last chapter, we looked at how to influence which handler method is invoked for a particular request by incorporating an HTTP method name into the name of a handler method—for example, OnGet, OnPost, and so on. Before the handler selection process can take place, the correct page must be selected. This chapter focuses on routing, which is the process that maps the incoming request to a specific page, or endpoint (incoming URLs), and generates URLs that map to those endpoints (outgoing URLs).
Many web application frameworks map URLs to a web page’s file path on disk based on matching the URL segments to a folder structure. Continuing the theme of a web application that provides vacation packages from the last chapter, table 4.1 provides some examples of this one-to-one match between some imagined segmented URLs and their file paths in a web application.