ASP.NET Core Interview Question #86
What is endpoint routing?
Middleware & Request Pipeline Mid-Level Intermediate
Quick Interview Answer
Endpoint routing is the ASP.NET Core routing system that matches requests to executable endpoints. An endpoint can represent a controller action, Razor Page, minimal API handler, SignalR hub, health check, or other endpoint type.
Detailed Explanation
Endpoint routing is the ASP.NET Core routing system that matches requests to executable endpoints. An endpoint can represent a controller action, Razor Page, minimal API handler, SignalR hub, health check, or other endpoint type.
Endpoints contain metadata describing requirements such as authorization policies, CORS behavior, filters, or other framework-specific information.
This design allows middleware to inspect the selected endpoint and its metadata before the endpoint executes.
Code Example
app.MapGet("/products/{id:int}", (int id) =>
{
return Results.Ok(new { Id = id });
});
app.MapControllers();
app.MapRazorPages();