AlbAdapter
@h4ad/serverless-adapter > AlbAdapter
(class) AlbAdapter
The adapter to handle requests from AWS ALB
Signature:
export declare class AlbAdapter implements AdapterContract<ALBEvent, Context, ALBResult>
Implements: AdapterContract <ALBEvent, Context, ALBResult>
Example
const stripBasePath = '/any/custom/base/path'; // default ''
const adapter = new AlbAdapter(\{ stripBasePath });
(constructor)
Default constructor
Signature:
constructor(options?: AlbAdapterOptions | undefined);
Parameters
Parameter | Type | Description |
---|---|---|
options | AlbAdapterOptions | undefined | (Optional) The options to customize the AlbAdapter |
(method) canHandle
Signature:
canHandle(event: unknown): event is ALBEvent;
Parameters
Parameter | Type | Description |
---|---|---|
event | unknown |
Returns:
event is ALBEvent
(method) getAdapterName
Signature:
getAdapterName(): string;
Returns:
string
(method) getPathFromEvent
Get path from event with query strings
Signature:
protected getPathFromEvent(event: ALBEvent): string;
Parameters
Parameter | Type | Description |
---|---|---|
event | ALBEvent | The event sent by serverless |
Returns:
string
(method) getRequest
Signature:
getRequest(event: ALBEvent): AdapterRequest;
Parameters
Parameter | Type | Description |
---|---|---|
event | ALBEvent |
Returns:
(method) getResponse
Signature:
getResponse(\{ event, headers: responseHeaders, body, isBase64Encoded, statusCode, }: GetResponseAdapterProps<ALBEvent>): ALBResult;
Parameters
Parameter | Type | Description |
---|---|---|
{ event, headers: responseHeaders, body, isBase64Encoded, statusCode, } | GetResponseAdapterProps <ALBEvent> |
Returns:
ALBResult
(method) onErrorWhileForwarding
Signature:
onErrorWhileForwarding(\{ error, delegatedResolver, respondWithErrors, event, log, }: OnErrorProps<ALBEvent, ALBResult>): void;
Parameters
Parameter | Type | Description |
---|---|---|
{ error, delegatedResolver, respondWithErrors, event, log, } | OnErrorProps <ALBEvent, ALBResult> |
Returns:
void
(property) options
Signature:
protected readonly options?: AlbAdapterOptions | undefined;
(property) stripPathFn
Strip base path function
Signature:
protected stripPathFn: StripBasePathFn;