Creating Your First Minimal API
Bootstrap a Minimal API project, define route handlers, and return typed results with minimal boilerplate.
What Are Minimal APIs?
Minimal APIs, introduced in .NET 6, let you build HTTP endpoints with minimal ceremony — no controllers, no action attributes, just route handlers defined directly in Program.cs. They're ideal for microservices and lightweight APIs.
The Simplest Minimal API
A complete HTTP API in just a few lines. The MapGet, MapPost, MapPut, and MapDelete methods define route handlers for each HTTP verb.
var builder = WebApplication.CreateBuilder(args);
var app = builder.Build();
app.MapGet("/", () => "Hello, Minimal API!");
app.MapGet("/ping", () => Results.Ok(new { status = "pong" }));
app.Run();
// That's it — no Startup.cs, no controllersAll lessons in this course
- Creating Your First Minimal API
- Route Groups, Parameters & Validation
- Middleware & Filters in Minimal APIs
- OpenAPI, Versioning & Deployment