diff --git a/docs/ENGINEERING_HARNESS.md b/docs/ENGINEERING_HARNESS.md index 1d0a105..bc78e9f 100644 --- a/docs/ENGINEERING_HARNESS.md +++ b/docs/ENGINEERING_HARNESS.md @@ -88,6 +88,38 @@ | Form | `XForm.razor` | 입력 컴포넌트와 UI validation | | Tests | unit + Playwright/API smoke | 회귀 방지 | +## FastEndpoints Framework + +새 API 엔드포인트는 Controllers 대신 **FastEndpoints**로 구현한다. + +| 규칙 | 실행 | +| --- | --- | +| Library | `FastEndpoints` v5.30.0 이상 | +| Naming | `Create[Entity]Endpoint`, `Get[Entity]Endpoint`, `List[Entity]Endpoint` 등 | +| Location | `src/TaxBaik.Web/Features/[DomainName]/` | +| Pattern | Request DTO → Endpoint class → Response DTO | +| Validation | FluentValidation (FastEndpoints 내장) | +| Registration | `builder.Services.AddFastEndpoints()` + `app.MapFastEndpoints()` | +| Coexistence | Controllers와 FastEndpoints는 PathBase 내에서 병행 가능 (URL 충돌만 피함) | + +**주의**: 기존 Controllers에서 FastEndpoints로 마이그레이션 시, 기존 엔드포인트 URL(`/api/*`)이 변경되지 않도록 명시적 라우팅을 지정한다. + +```csharp +public class GetBlogEndpoint : Endpoint +{ + public override void Configure() + { + Get("/api/blog/{id}"); + AllowAnonymous(); + } + + public override async Task HandleAsync(GetBlogRequest req, CancellationToken ct) + { + // Logic here + } +} +``` + ## Rendering Boundary | 영역 | 렌더링 | 데이터 접근 |