Skip to content

cullinan.controller

Note (v0.90): Controller DI is now managed by ApplicationContext. For the new IoC/DI 2.0 architecture, see Dependency Injection Guide.

Summary: Controller registration, lifecycle, and injection into controller instances. Document usage patterns and common pitfalls.

Public API (auto-generated)

cullinan.controller

Name Kind Signature / Value
controller function controller(**kwargs) -> Callable
get_controller_registry function get_controller_registry() -> cullinan.controller.registry.ControllerRegistry
get_header_registry function get_header_registry() -> cullinan.controller.core.HeaderRegistry
request_resolver function request_resolver(self, url_param_key_list: Optional[Sequence] = None, url_param_value_list: Optional[Sequence] = None, query_param_names: Optional[Sequence] = None, body_param_names: Optional[Sequence] = None, file_param_key_list: Optional[Sequence] = None) -> Tuple[Optional[dict], Optional[dict], Optional[dict], Optional[dict]]
reset_controller_registry function reset_controller_registry() -> None
response_build function response_build(**kwargs) -> cullinan.controller.core.StatusResponse

Example: register a simple controller

from cullinan.controller import controller, get_api

@controller(url='/hello')
class HelloController:
    @get_api(url='')
    def hello(self):
        return {'status': 200, 'body': 'Hello World'}

Notes: - Use the @controller decorator to mark controller classes, url parameter specifies URL prefix. - Use @get_api, @post_api and other decorators to define HTTP endpoints. - The framework supports automatic discovery via module scanning.