Keep HTTP at the Edge
Easy About 20 min Katabench Pro
The returns application accepts a web request type directly, so transport points inward and the controller has no real use-case boundary. Map HTTP at the edge and drive an application-owned port.
The full brief is part of Katabench Pro
Pro opens this kata's brief, its starter code and its grader. To see how the track works first, try Move the Port Home, which is free.
How it is graded
You work across multiple files, and architecture rules turn the design boundaries into executable feedback.
What it practices
- Layered architecture
- Keep transport, wire formats and versions at the edge and route calls through each layer.
- Ports and adapters
- Driving and driven adapters meet the application only through its ports.
Related katas
- Move the Port Home Medium Free A
*Portabstraction is declared beside its adapter, so the core reaches outward to see its own port. Move the single port into the core; duplicating it leaves a stray copy that fails the role-placement rule. - The Layer Skip Medium Free A controller reaches past the application layer straight into infrastructure for the order total. Route the call back through the middle layer with a port the application owns; a thin pass-through that still touches infrastructure only moves the smell, it doesn't remove it.
- Two Sides of the Hexagon Medium Free A driving (web) adapter reaches the driven (persistence) adapter directly for a quick existence check. Inject the repository "via its interface" and you'll find the seam is still on the wrong side of the hexagon.
- A Repository Out of Place Easy Pro A concrete
*Repositoryhas settled into the core, right next to the port it implements. Move the role to the layer where it belongs; renaming it to dodge the placement rule trips the naming rule instead.