Skip to content
Ieuan Walker edited this page Nov 13, 2025 · 12 revisions

1. Installation

Install the NuGet package:

Nuget Nuget

dotnet add package IeuanWalker.MinimalApi.Endpoints

2. Register Your 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)

3. Create your first endpoint

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

Clone this wiki locally