minimal API
An ASP.NET Core style that declares each route and its handler together, as in app.MapGet("/api/ping", () => Results.Ok("catalog")).
In more detail
Handler parameters are bound from the request and from dependency injection by type and name. It removes the controller class, not the pipeline, validation or testing; route groups share prefixes and metadata.
Related terms
- controller — In ASP.NET Core, a class deriving from ControllerBase that groups related HTTP endpoints as methods called actions.
- route group — A set of minimal API endpoints created with MapGroup that share a URL prefix and metadata such as tags, authorization or rate limiting.
- IResult — The type minimal API handlers return to describe an HTTP response, created with helpers such as Results.Ok(product) or Results.NotFound().
- endpoint metadata — Extra information attached to an endpoint, such as tags, accepted and produced types or authorization requirements, used by middleware and OpenAPI.
Taught in
- The ASP.NET Core Middleware Pipeline — Modern .NET Core, C# & Enterprise Microservices
- Building Routes with Minimal APIs — Modern .NET Core, C# & Enterprise Microservices
- Comparing Controllers and Minimal APIs — Modern .NET Core, C# & Enterprise Microservices
- Global Exception Handling and Problem Details — Modern .NET Core, C# & Enterprise Microservices
- Role-Based and Policy-Based Authorization — Modern .NET Core, C# & Enterprise Microservices
- OpenTelemetry, Container Publishing and Trimming — Modern .NET Core, C# & Enterprise Microservices