-
-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Ieuan Walker edited this page Nov 13, 2025
·
12 revisions
Install the NuGet package:
dotnet add package IeuanWalker.MinimalApi.Endpoints
using YourAssembly;
var builder = WebApplication.CreateBuilder(args);
// Register all endpoints
builder.AddEndpoints();
var app = builder.Build();
// Map all endpoints
app.MapEndpoints();
app.Run();If you have endpoints in multiple assemblies/ projects, there are the following extension methods
.AddEndpointsFromAssembly()and.MapEndpointsFromAssembly(). (replace assembly with the assembly the endpoints are located in)
public class HelloWorldEndpoint : IEndpointWithoutRequest<string>
{
public static void Configure(RouteHandlerBuilder builder)
{
builder.Get("/api/HelloWorld");
}
public async Task<string> Handle(CancellationToken ct)
{
return await Task.FromResult("Hello world");
}
}And that's it, run your API and test your endpoints.
Tip: Press F12 on the extension methods to view the minimal api code its generated for you
Getting Started
Endpoints
- Endpoint interfaces
- HTTP verbs
- Request binding
- Grouping
- Returning multiple different responses
- Dependency injection
Validation
OpenAPI & Documentation