MESK.MiniEndpoint
1.0.0
dotnet add package MESK.MiniEndpoint --version 1.0.0
NuGet\Install-Package MESK.MiniEndpoint -Version 1.0.0
<PackageReference Include="MESK.MiniEndpoint" Version="1.0.0" />
<PackageVersion Include="MESK.MiniEndpoint" Version="1.0.0" />
<PackageReference Include="MESK.MiniEndpoint" />
paket add MESK.MiniEndpoint --version 1.0.0
#r "nuget: MESK.MiniEndpoint, 1.0.0"
#:package MESK.MiniEndpoint@1.0.0
#addin nuget:?package=MESK.MiniEndpoint&version=1.0.0
#tool nuget:?package=MESK.MiniEndpoint&version=1.0.0
MESK.MiniEndpoint
MESK.MiniEndpoint is a lightweight library for modular endpoint registration in ASP.NET Core applications. It enables you to define endpoints in a decoupled way and register them automatically via assembly scanning, promoting clean architecture and separation of concerns.
Features
- Modular endpoint registration: Implement the
IEndpointinterface to define endpoints in separate classes. - Automatic discovery: Register all endpoint classes in an assembly with a single call.
- Integration with ASP.NET Core: Easily map endpoints to your application or route groups.
- Testable and extensible: Designed for easy unit and integration testing.
Getting Started
Installation
Add a reference to the MESK.MiniEndpoint project or NuGet package in your ASP.NET Core application.
Usage
- Define an endpoint:
public class MyEndpoint : IEndpoint { public void MapEndpoints(IEndpointRouteBuilder app) { app.MapGet("/hello", () => "Hello, World!"); } } - Register endpoints in Program.cs:
var builder = WebApplication.CreateBuilder(args); builder.Services.AddMiniEndpoints(typeof(MyEndpoint).Assembly); var app = builder.Build(); app.MapMiniEndpoints(); app.Run(); - Optional: Use with route groups:
var apiGroup = app.MapGroup("/api/v1"); app.MapMiniEndpoints(apiGroup);
How It Works
- Implement the
IEndpointinterface for each endpoint class. AddMiniEndpoints(assembly)scans the assembly for all non-abstract, non-interface classes implementingIEndpointand registers them as transient services.MapMiniEndpointsresolves all registered endpoints and calls theirMapEndpointsmethod to map routes.
Testing
Unit and integration tests are provided in the MESK.MiniEndpoint.Test project. Tests cover:
- Registration of valid endpoints
- Exclusion of abstract classes and interfaces
- Transient service lifetime
- Integration with ASP.NET Core pipeline
To run tests:
dotnet test MESK.MiniEndpoint.Test
Requirements
- .NET 9.0 or later
- ASP.NET Core
License
MIT License
Created by Mehmet Solak
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net9.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0 | 268 | 8/27/2025 |