Documentation
    Preparing search index...

    Http context encapsulates properties for a given HTTP request. The context class can be extended using macros and getters.

    Hierarchy

    • default
      • HttpContext
    Index

    Constructors

    • Creates a new HttpContext instance

      Parameters

      • request: Request

        The HTTP request instance

      • response: Response

        The HTTP response instance

      • logger: Logger

        The logger instance

      • containerResolver: ContainerResolver<any>

        The IoC container resolver

      Returns HttpContext

    Properties

    route?: RouteJSON

    Reference to the current route. Not available inside server middleware

    routeKey?: string

    A unique key for the current route

    params: Record<string, any> = {}

    Route params

    subdomains: Record<string, any> = {}

    Route subdomains

    request: Request

    The HTTP request instance

    response: Response

    The HTTP response instance

    logger: Logger

    The logger instance

    containerResolver: ContainerResolver<any>

    The IoC container resolver

    Accessors

    • get usingAsyncLocalStorage(): boolean

      Find if async localstorage is enabled for HTTP requests or not

      Returns boolean

    Methods

    • Run a method that doesn't have access to HTTP context from the async local storage.

      Type Parameters

      • T

      Parameters

      • callback: (...args: any[]) => T
      • ...args: any[]

      Returns T