.NET and ASP.NET Core 10 · ASP.NET Core code

Write a minimal API

Define endpoints without controllers.

var builder = WebApplication.CreateBuilder(args);
var app = builder.Build();

app.MapGet("/", () => "Hello World!");
app.MapGet("/users/{id}", (int id) => Results.Ok(new { id }));

app.Run();

Official .NET and ASP.NET Core 10 documentation

More asp.net core code commands

All asp.net core code commands · .NET and ASP.NET Core 10 cheatsheet

Was this page helpful?