Scaffold a new Minimal API endpoint following project conventions
Create a new Minimal API endpoint in src/Feirb.Api/.
Given an endpoint description (from args or ask the user), create the following:
src/Feirb.Shared/Feirb.Shared.Models namespacesrc/Feirb.Api/Endpoints/Create or extend a static class following this pattern:
namespace Feirb.Api.Endpoints;
public static class {Feature}Endpoints
{
public static void Map{Feature}Endpoints(this WebApplication app)
{
var group = app.MapGroup("/api/{feature}")
.WithTags("{Feature}");
group.MapGet("/", GetAllAsync);
// ... more endpoints
}
private static async Task<Results<Ok<ResponseDto>, NotFound>> GetAllAsync(
IService service,
CancellationToken cancellationToken)
{
// Implementation
}
}
src/Feirb.Api/Program.csAdd: app.Map{Feature}Endpoints();
tests/Feirb.Api.Tests/Create a test class following naming convention: {Feature}EndpointsTests.cs
Results<T1, T2> return types for explicit HTTP response modelingasync Task<> with CancellationTokenMapGroup.WithTags() for OpenAPI grouping