CoreMesh.Endpoints
0.1.0
dotnet add package CoreMesh.Endpoints --version 0.1.0
NuGet\Install-Package CoreMesh.Endpoints -Version 0.1.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CoreMesh.Endpoints" Version="0.1.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CoreMesh.Endpoints" Version="0.1.0" />
<PackageReference Include="CoreMesh.Endpoints" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add CoreMesh.Endpoints --version 0.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: CoreMesh.Endpoints, 0.1.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package CoreMesh.Endpoints@0.1.0
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=CoreMesh.Endpoints&version=0.1.0
#tool nuget:?package=CoreMesh.Endpoints&version=0.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
繁體中文 | English
CoreMesh.Endpoints
CoreMesh.Endpoints provides a lightweight endpoint discovery and mapping abstraction for ASP.NET Core.
It allows you to:
- Define endpoints as classes
- Register endpoint implementations through assembly scanning
- Map normal endpoints and grouped endpoints in one place
Features
IEndpoint: map root endpointsIGroupEndpoint: define a route group and configure shared metadataIGroupedEndpoint<TGroup>: map endpoints under a specific groupAddEndpoints(): scan loaded assemblies and register endpoint typesMapEndpoints(): map registered endpoints toWebApplication
Installation
Reference the project/package and call:
using CoreMesh.Endpoints.Extensions;
builder.Services.AddEndpoints();
var app = builder.Build();
app.MapEndpoints();
Core Interfaces
IEndpoint
Use for root endpoints:
using CoreMesh.Endpoints;
public sealed class PingEndpoint : IEndpoint
{
public void AddRoute(IEndpointRouteBuilder app)
{
app.MapGet("/ping", () => Results.Ok("pong"));
}
}
IGroupEndpoint + IGroupedEndpoint<TGroup>
Use when you want a route group with shared configuration:
using CoreMesh.Endpoints;
public sealed class ProductsGroup : IGroupEndpoint
{
public string GroupPrefix => "/products";
public void Configure(RouteGroupBuilder group)
{
group.WithTags("Products");
}
}
public sealed class GetProductsEndpoint : IGroupedEndpoint<ProductsGroup>
{
public void AddRoute(RouteGroupBuilder group)
{
group.MapGet("/", () => Results.Ok(Array.Empty<object>()));
}
}
Design Notes (Current Version)
- Endpoint discovery uses
AppDomain.CurrentDomain.GetAssemblies() - Endpoints are currently registered as
Singleton - Mapping is convention-based using implemented interfaces (
IEndpoint,IGroupEndpoint,IGroupedEndpoint)
These behaviors are intentionally kept close to the original implementation and may be refined in later iterations.
Testing
Current tests cover:
AddEndpoints()registration for endpoint/group/grouped endpoint typesMapEndpoints()invocation ofAddRoute()and group mapping behavior
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net10.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.