Controllers are the C part of the MVC pattern. They are a set of actions that usually handle requests from a client. You should bear in mind that what we are discussing in this chapter refers to the MVC stack that's defined by ASP.NET Core. Furthermore, if we take as reference the incoming requests, remember that they have already passed through the others middleware in the middleware pipeline and that they have already hit the MVC middleware.
The following diagram shows how a request is typically handled:
As we discussed in Chapter 1, REST 101 and Getting Started with ASP.NET Core, the incoming request is usually generated by a client: the browser, another API, or an external system. The request is composed of an HTTP verb, a URI, body payload, and other additional information. The Routing engine handles the request and passes it to an action method...