cullinan.web.controller¶
cullinan.web.controller contains the controller decorator plus REST-style route decorators and compatibility registries.
Main exports¶
controllerget_apipost_apipatch_apidelete_apiput_apiresponse_build
Compatibility and advanced exports:
get_controller_registry()reset_controller_registry()get_header_registry()HandlerHttpResponseStatusResponse
Example¶
from cullinan.web.controller import controller, get_api
from cullinan.web.params import Path
@controller(url="/users")
class UserController:
service: UserService # ← 构造注入
@get_api(url="/{user_id}")
async def get_user(self, user_id: int = Path()):
return {"id": user_id}
New applications should treat controllers as part of the unified ApplicationContext-driven runtime, not as a standalone registry system.