Skip to main content

BaseHandler

@h4ad/serverless-adapter > BaseHandler

(class) BaseHandler

The abstract class that represents the base class for a handler

Signature:

export declare abstract class BaseHandler<TApp, TEvent, TContext, TCallback, TResponse, TReturn> implements HandlerContract<TApp, TEvent, TContext, TCallback, TResponse, TReturn> 

Implements: HandlerContract <TApp, TEvent, TContext, TCallback, TResponse, TReturn>

(method) getAdapterByEventAndContext

Get the adapter to handle a specific event and context

Signature:

protected getAdapterByEventAndContext(event: TEvent, context: TContext, adapters: AdapterContract<TEvent, TContext, TResponse>[], log: ILogger): AdapterContract<TEvent, TContext, TResponse>;

Parameters

ParameterTypeDescription
eventTEventThe event sent by serverless
contextTContextThe context sent by serverless
adaptersAdapterContract <TEvent, TContext, TResponse>[]The list of adapters
logILoggerThe instance of logger

Returns:

AdapterContract <TEvent, TContext, TResponse>

(method) getHandler

Get the handler that will handle serverless requests

Signature:

abstract getHandler(app: TApp, framework: FrameworkContract<TApp>, adapters: AdapterContract<TEvent, TContext, TResponse>[], resolverFactory: ResolverContract<TEvent, TContext, TCallback, TResponse, TReturn>, binarySettings: BinarySettings, respondWithErrors: boolean, log: ILogger): ServerlessHandler<TReturn>;

Parameters

ParameterTypeDescription
appTApp
frameworkFrameworkContract <TApp>
adaptersAdapterContract <TEvent, TContext, TResponse>[]
resolverFactoryResolverContract <TEvent, TContext, TCallback, TResponse, TReturn>
binarySettingsBinarySettings
respondWithErrorsboolean
logILogger

Returns:

ServerlessHandler <TReturn>

(method) getServerlessRequestResponseFromAdapterRequest

Get serverless request and response frmo the adapter request

Signature:

protected getServerlessRequestResponseFromAdapterRequest(requestValues: AdapterRequest): [request: ServerlessRequest, response: ServerlessResponse];

Parameters

ParameterTypeDescription
requestValuesAdapterRequestThe request values from adapter

Returns:

[request: ServerlessRequest , response: ServerlessResponse ]