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

Parameter

Type

Description

event

TEvent

The event sent by serverless

context

TContext

The context sent by serverless

adapters

AdapterContract <TEvent, TContext, TResponse>[]

The list of adapters

log

ILogger

The 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

Parameter

Type

Description

app

TApp

framework

FrameworkContract <TApp>

adapters

AdapterContract <TEvent, TContext, TResponse>[]

resolverFactory

ResolverContract <TEvent, TContext, TCallback, TResponse, TReturn>

binarySettings

BinarySettings

respondWithErrors

boolean

log

ILogger

Returns:

ServerlessHandler <TReturn>

(method) getServerlessRequestResponseFromAdapterRequest

Get serverless request and response frmo the adapter request

Signature:

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

Parameters

Parameter

Type

Description

requestValues

AdapterRequest

The request values from adapter

Returns:

[request: ServerlessRequest , response: ServerlessResponse ]