.NET 6 arrived in November 2021. Its minimal API approach made small HTTP services easier to express, but fewer lines of endpoint setup do not automatically produce a maintainable application.

Keep the transport layer readable

An endpoint should make the request contract and response behaviour easy to find. Validation belongs at the boundary; business rules should have a home that can be exercised without starting a web server.

For example, approving a purchase order involves more than binding a JSON body. The operation may need to check an approval limit, confirm the order’s current state and persist an audit event. Hiding that sequence inside a long route lambda makes it harder to review.

Test the failure contract

Start with three cases: a valid request, invalid input and a request that conflicts with the current business state. Define which errors the caller can correct and which require support investigation. Avoid returning implementation exceptions as the public API contract.

Keep one integration test that crosses the HTTP boundary. Unit tests for a handler cannot detect an incorrectly bound parameter or a missing authorisation policy.

The lasting lesson from this period is useful regardless of framework version: make setup concise, then spend the saved attention on contracts and behaviour. New deployments should use a currently supported runtime.

Reference

Microsoft’s .NET 6 announcement.