Get Started
Minimal Service
Move logic out of the controller so the code does not thicken like autumn fog.
Get StartedFirst Service
When a controller starts doing more than receiving a request and returning a response, the code quickly becomes harder to scale and maintain. That is why business logic is better moved into services. This keeps the HTTP layer thin and also makes testing and code reuse much easier.
A Small Service
from autumn import service
@service
class GreetingService:
def build_message(self, name: str) -> str:
return f'Hello from service, {name}'
A Simple Rule
Controllersdeal with HTTP: they receive requests and shape responses.Servicesdescribe business actions, orchestration, and application logic.