Terminal middleware short-circuits the ASP.NET Core middleware pipeline by generating and returning a response. Later middleware, including endpoint middleware, never receives that request. section 4.1
Requests normally move forward through middleware until a component creates a response. That response then travels backward through the earlier components before reaching the web server, so middleware can run logic on both directions. section 4.1
Returning the current time
A small custom terminal component can return the current time as plain text whenever the application receives a request. This response ends processing rather than flowing to an endpoint. section 31.1
Use terminal middleware for small responses that do not need endpoint routing, such as a welcome page or Swagger response. Prefer endpoint routing when it provides the needed behavior; use custom middleware for occasional specialized requirements. section 31.1

