An endpoint defines how an application generates a response for a request. In an ASP.NET Core minimal API, you map an endpoint to a URL path and an HTTP verb. A browser request to the path / normally uses GET; an endpoint mapped to that combination can return “Hello World!”. section 3.6
Start with two GET endpoints
After building a WebApplication, call app.MapGet("/", () => "Hello World!") to return plain text at /. Add app.MapGet("/person", () => new Person("Andrew", "Lock")) to return a Person record as JSON at /person. Call app.Run() to start listening for requests. section 3.6 section 3.7
Mapping an endpoint and running it are separate steps. RoutingMiddleware selects an endpoint whose route matches the incoming request; EndpointMiddleware executes the selection. If no route template matches, EndpointMiddleware does not generate a response. Middleware between those two stages can inspect the selected endpoint before it runs. section 6.2 section 6.5
Figure 6.3 Endpoint routing uses a two-step process. The RoutingMiddleware selects which endpoint to execute, and the EndpointMiddleware executes it. If the request URL doesn’t match a route template, the endpoint middleware won’t generate a response.
The diagram follows a request through endpoint selection and execution, including the case where no route matches. section 6.2
Endpoints are not limited to minimal APIs: health checks and Razor Pages can also be registered with WebApplication. Route templates describe the URLs an endpoint can match, and route parameters let one endpoint handle multiple URLs. Choose routes carefully because they form a public surface of an API. section 6.2 section 6.5

























