IHttpEndpoint: {
    handler: HttpHandler;
    method?: OneOrAtLeastOne<HttpMethod>;
    middlewares?: Invokable<[builder: IMiddlewareBuilder], void>;
    url: string;
}

Defines a single HTTP endpoint registration.

IMPORT_PATH: "@daiso-tech/core/http-router/contracts"

Type declaration

  • handler: HttpHandler

    The handler that processes requests to this endpoint.

  • Optionalmethod?: OneOrAtLeastOne<HttpMethod>

    The HTTP method(s) this endpoint responds to.

    [
    "CONNECT",
    "DELETE",
    "GET",
    "HEAD",
    "OPTIONS",
    "PATCH",
    "POST",
    "PUT",
    "TRACE",
    ]
  • Optionalmiddlewares?: Invokable<[builder: IMiddlewareBuilder], void>

    Middleware handlers that apply only to this endpoint. Prefer this over IHttpRouterBase.use when the middleware is specific to a single route — it keeps middleware scoped and avoids unintended side effects on other endpoints.

  • url: string

    The URL path pattern for this endpoint.