How melandel/dotnet-web-service works
Project type and purpose
• This is a single‐service ASP .NET Core Web API (a “monolith”) whose only responsibility is to expose HTTP endpoints to return greeting messages.
• There is no database or UI in this repo—just a backend API, a shared cross‐cutting library, a battery of in‐process tests, plus documentation (architecture decision logs) and CI/CD scripts.
Key components
a. External Client
• Any HTTP client (curl, Postman, browser) invoking the greeting endpoint.
b. ASP .NET Core Web Service
• Program.cs / Startup logic (web host, Kestrel).
• Middleware pipeline:
– Routing (Kebab-case converter)
– Error-handling middleware (translates exceptions into RFC 7807 ProblemDetails)
– Enum-handling filters and JSON serialization options.
– Swagger/OpenAPI generator & UI.
• Controllers (ApiController.cs) implementing endpoints.
• Configuration (appsettings.json / launchSettings.json).
c. Cross-Cutting Concerns Library
• Shared types and converters (constrained types, enum naming conventions, JSON converters, error-handling types).
• Referenced by the API project to enforce policies.
d. Test Project (FearlessProgramming Tests)
• In‐memory test server to simulate HTTP requests.
• Test doubles, test archetypes, coding-standards suites, routing and error-handling suites.
e. Documentation & CI/CD
• adl/ (Architecture Decision Records)
• cicd/ (build and deployment scripts or guidance)
How these components interact
• The HTTP client issues a request → Kestrel receives it → ASP .NET middleware pipeline applies routing, filters, error handlers, JSON settings → Controller executes business logic (constructs greeting string) → Response passes back through middleware to client.
• The API project references the Cross-Cutting Concerns library to share serialization rules and error types.
• The Test Project spins up an in-memory host of the API to exercise the full pipeline and validate policies.
• CI/CD scripts build both API and Test projects, run tests, and (optionally) package/deploy the API.
Architectural patterns and principles
• Middleware pipeline (chain of responsibility) for cross-cutting policies.
• Feature-folder organization in the API (controllers + concerns grouped by functionality).
• “Clean” separation of concerns: serialization, routing, error handling, swagger setup all in dedicated extension methods or filters.
• In-process integration testing via test server and test doubles, enforcing “nothing-up-your-sleeve” transparency.