Claude-skill-registry api-setup
Configure affolterNET.Web.Api service registration and middleware pipeline. Use when setting up AddApiServices, ConfigureApiApp, or configuring the API middleware order.
install
source · Clone the upstream repo
git clone https://github.com/majiayu000/claude-skill-registry
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/data/api-setup" ~/.claude/skills/majiayu000-claude-skill-registry-api-setup && rm -rf "$T"
manifest:
skills/data/api-setup/SKILL.mdsource content
API Setup
Configure the affolterNET.Web.Api service registration and middleware pipeline.
For complete reference, see Library Guide.
Quick Start
// Program.cs var builder = WebApplication.CreateBuilder(args); // Step 1: Register services var options = builder.Services.AddApiServices( builder.Environment.IsDevelopment(), builder.Configuration, opts => { opts.EnableSecurityHeaders = true; opts.ConfigureApi = api => { api.AuthMode = AuthenticationMode.Authorize; }; }); var app = builder.Build(); // Step 2: Configure middleware app.ConfigureApiApp(options); app.Run();
Configuration Options
ApiAppOptions
| Property | Type | Description |
|---|---|---|
| bool | Enable security headers middleware |
| Action<ApiOptions> | Configure API-specific options |
| Action<IApplicationBuilder> | Add custom middleware after routing |
| Action<IApplicationBuilder> | Add custom middleware before endpoints |
ApiOptions
| Property | Type | Default | Description |
|---|---|---|---|
| AuthenticationMode | | Authentication mode (None/Authenticate/Authorize) |
Middleware Pipeline
The
ConfigureApiApp configures middleware in this order:
- Security Headers Middleware
- Swagger/OpenAPI
- Routing
- Custom Middleware (after routing hook)
- CORS
- Authentication & Authorization + RPT Middleware
- Custom Middleware (before endpoints hook)
- Endpoint Mapping (with Health Checks)
Common Patterns
Development vs Production
var options = builder.Services.AddApiServices( builder.Environment.IsDevelopment(), // isDev flag builder.Configuration, opts => { // Development-specific config happens automatically // based on isDev flag });
Adding Custom Middleware
var options = builder.Services.AddApiServices(isDev, config, opts => { opts.ConfigureAfterRoutingCustomMiddleware = app => { app.UseMiddleware<RequestLoggingMiddleware>(); }; opts.ConfigureBeforeEndpointsCustomMiddleware = app => { app.UseMiddleware<TenantMiddleware>(); }; });