Skip to content

cullinan.web.controller

cullinan.web.controller contains the controller decorator plus REST-style route decorators and compatibility registries.

Main exports

  • controller
  • get_api
  • post_api
  • patch_api
  • delete_api
  • put_api
  • response_build

Compatibility and advanced exports:

  • get_controller_registry()
  • reset_controller_registry()
  • get_header_registry()
  • Handler
  • HttpResponse
  • StatusResponse

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.

See also