Skip to main content

Interface: HttpAdapter

An interface representing an HTTP adapter. It defines the contract for handling HTTP-related operations.

Methods​

getHttpServer()​

getHttpServer(): HttpServer

Retrieves the underlying HTTP server instance used by the adapter.

Returns​

HttpServer

The HTTP server instance, which can be of type http.Server, https.Server, http2.Http2Server, or http2.Http2SecureServer.


getRegisteredRoutes()​

getRegisteredRoutes(): readonly RouteDefinition[]

Retrieves the registered routes from the adapter.

Returns​

readonly RouteDefinition[]

An array of route definitions that have been registered with the adapter.


initialize()?​

optional initialize(): void | Promise<void>

Initializes the HTTP adapter.

Returns​

void | Promise<void>

A promise that resolves when the adapter has been initialized, or void if the operation is synchronous.


registerRoutes()​

registerRoutes(routes): void | Promise<void>

Registers the provided routes with the adapter.

Parameters​

routes​

readonly RouteDefinition[]

An array of route definitions to be registered.

Returns​

void | Promise<void>

A promise that resolves when the routes have been registered, or void if the operation is synchronous.


start()​

start(): void | Promise<void>

Starts the HTTP adapter.

Returns​

void | Promise<void>

A promise that resolves when the adapter has been started, or void if the operation is synchronous.


stop()​

stop(): void | Promise<void>

Stops the HTTP adapter.

Returns​

void | Promise<void>

A promise that resolves when the adapter has been stopped, or void if the operation is synchronous.