スキル一覧に戻る
Mcafee123

api-setup

by Mcafee123

0🍴 0📅 2026年1月10日
GitHubで見るManusで実行

SKILL.md


name: api-setup description: Configure affolterNET.Web.Api service registration and middleware pipeline. Use when setting up AddApiServices, ConfigureApiApp, or configuring the API middleware order.

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

PropertyTypeDescription
EnableSecurityHeadersboolEnable security headers middleware
ConfigureApiActionConfigure API-specific options
ConfigureAfterRoutingCustomMiddlewareActionAdd custom middleware after routing
ConfigureBeforeEndpointsCustomMiddlewareActionAdd custom middleware before endpoints

ApiOptions

PropertyTypeDefaultDescription
AuthModeAuthenticationModeNoneAuthentication mode (None/Authenticate/Authorize)

Middleware Pipeline

The ConfigureApiApp configures middleware in this order:

  1. Security Headers Middleware
  2. Swagger/OpenAPI
  3. Routing
  4. Custom Middleware (after routing hook)
  5. CORS
  6. Authentication & Authorization + RPT Middleware
  7. Custom Middleware (before endpoints hook)
  8. 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>();
    };
});

スコア

総合スコア

50/100

リポジトリの品質指標に基づく評価

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

0/10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

0/5

レビュー

💬

レビュー機能は近日公開予定です