.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
- Register a service
- Read configuration
- Set up user secrets
- Store a development secret
- Add authentication and authorization
- Map controllers
All asp.net core code commands · .NET and ASP.NET Core 10 cheatsheet