Stratal API Reference
    Preparing search index...

    Class RouterService

    RouterService manages HTTP routing and request handling with OpenAPI support

    Responsibilities:

    • Creates and configures OpenAPIHono application
    • Delegates to specialized services:
      • RequestScopeService: Request-scoped container setup
      • OpenAPIService: OpenAPI spec and documentation endpoints
      • RouteRegistrationService: Controller and route registration
    • Registers global middleware (CORS, logging, error handling)
    • Handles fetch requests via Hono

    Note: Route access control (domain-based enforcement) is handled by RouteAccessMiddleware in the tenancy module, applied via TenancyModule.configure().

    The service is registered as a singleton in the DI container and accessed by the Backend worker's fetch() method.

    Index

    Constructors

    Methods

    Constructors

    Methods

    • Handle incoming fetch request via Hono

      This method is called by the Backend worker's fetch() method. The request-scoped container is created in RequestScopeService.

      Parameters

      • request: Request

        Incoming Request object

      • env: StratalEnv

        Cloudflare environment bindings

      • ctx: ExecutionContext

        Cloudflare execution context

      Returns Response | Promise<Response>

      Response object