Skip to main content

httpApiWrapper

httpApiWrapper(handler, config?): (req, __namedParameters) => Promise<Response>

Wraps an HTTP API handler with common error handling, authorization, and logging logic. Ensures that all API endpoints have consistent error responses, logging, and authorization checks.

Parameters​

handler​

RequestHandler

The actual request handler function to wrap.

config?​

HttpApiWrapperConfig

Configuration for the wrapper. See HttpApiWrapperConfig.

Returns​

(req, __namedParameters): Promise<Response>

Parameters​

req​

Request

__namedParameters​

params​

Promise<Partial<QueryParams>>

Returns​

Promise<Response>