Stratal API Reference
    Preparing search index...

    Interface IController

    Controller interface for handling HTTP requests

    Controllers can implement RESTful methods or a custom handle() method. The route for the controller is set via the @Controller decorator.

    RESTful methods auto-map to HTTP verbs:

    • index() → GET /route
    • show() → GET /route/:id
    • create() → POST /route
    • update() → PUT /route/:id
    • patch() → PATCH /route/:id
    • destroy() → DELETE /route/:id

    For non-RESTful routes (wildcards, custom patterns), implement handle()

    interface IController {
        create?(ctx: RouterContext): Response | Promise<Response>;
        destroy?(ctx: RouterContext): Response | Promise<Response>;
        handle?(ctx: RouterContext): Response | Promise<Response>;
        index?(ctx: RouterContext): Response | Promise<Response>;
        patch?(ctx: RouterContext): Response | Promise<Response>;
        show?(ctx: RouterContext): Response | Promise<Response>;
        update?(ctx: RouterContext): Response | Promise<Response>;
    }
    Index

    Methods