Minimal API
noun
say it: “MIN-ih-mul AY-PEE-EYE” /ˈmɪnɪməl ˌeɪ piː ˈaɪ/
An ASP.NET Core style where each endpoint is mapped straight to a function, without controller classes.
What is Minimal API?
A minimal API maps each endpoint straight to a function with MapGet, MapPost and so on, with no controller classes. It is short, fast and the default in new templates.
app.MapGet("/recipes/{id:int}", async (int id, IRecipeRepository recipes) =>
await recipes.FindAsync(id) is { } recipe ? Results.Ok(recipe) : Results.NotFound());
In a sentence
- “Our small service is a minimal API: three MapGet lines in Program.cs.”
Level: Apprentice · More ASP.NET Core terms at this level
Updated