Organize your project by domain, not technical slices!
Simple module support, nothing else, no extra bloat.
Create a module
public class InfoModule: IModule
{
public IServiceCollection RegisterModules(IServiceCollection services)
{
services.AddSingleton(new InfoConfig());
return services;
}
public IEndpointRouteBuilder MapEndpoints(IEndpointRouteBuilder endpoints)
{
endpoints.MapGet("/info", () => {
...
});
endpoints.MapPost("/info", () => {
...
});
return endpoints;
}
}
Register Modules, and Endpoints in App builder creation using the extension methods:
var builder = WebApplication.CreateBuilder(args);
builder.RegisterModules();
var app = builder.Build();
app.MapModuleEndpoints();
app.Run();
See the Sample project here
MIT
Free Software, Hell Yeah!