Skip to main content

HuaweiApiGatewayAdapter

@h4ad/serverless-adapter > HuaweiApiGatewayAdapter

(class) HuaweiApiGatewayAdapter

The adapter to handle requests from Huawei Api Gateway

Signature:

export declare class HuaweiApiGatewayAdapter implements AdapterContract<HuaweiApiGatewayEvent, HuaweiContext, HuaweiApiGatewayResponse> 

Implements: AdapterContract <HuaweiApiGatewayEvent , HuaweiContext , HuaweiApiGatewayResponse >

Example

const stripBasePath = '/any/custom/base/path'; // default ''
const adapter = new ApiGatewayAdapter(\{ stripBasePath });

(constructor)

Default constructor

Signature:

constructor(options?: HuaweiApiGatewayOptions | undefined);

Parameters

ParameterTypeDescription
optionsHuaweiApiGatewayOptions | undefined(Optional) The options to customize the HuaweiApiGatewayAdapter

(method) canHandle

Signature:

canHandle(event: unknown): event is HuaweiApiGatewayEvent;

Parameters

ParameterTypeDescription
eventunknown

Returns:

event is HuaweiApiGatewayEvent

(method) getAdapterName

Signature:

getAdapterName(): string;

Returns:

string

(method) getPathFromEvent

Get path from event with query strings

Signature:

protected getPathFromEvent(event: HuaweiApiGatewayEvent): string;

Parameters

ParameterTypeDescription
eventHuaweiApiGatewayEventThe event sent by serverless

Returns:

string

(method) getRequest

Signature:

getRequest(event: HuaweiApiGatewayEvent): AdapterRequest;

Parameters

ParameterTypeDescription
eventHuaweiApiGatewayEvent

Returns:

AdapterRequest

(method) getResponse

Signature:

getResponse(\{ headers: responseHeaders, body, isBase64Encoded, statusCode, }: GetResponseAdapterProps<HuaweiApiGatewayEvent>): HuaweiApiGatewayResponse;

Parameters

ParameterTypeDescription
{ headers: responseHeaders, body, isBase64Encoded, statusCode, }GetResponseAdapterProps <HuaweiApiGatewayEvent >

Returns:

HuaweiApiGatewayResponse

(method) onErrorWhileForwarding

Signature:

onErrorWhileForwarding(\{ error, delegatedResolver, respondWithErrors, event, log, }: OnErrorProps<HuaweiApiGatewayEvent, HuaweiApiGatewayResponse>): void;

Parameters

ParameterTypeDescription
{ error, delegatedResolver, respondWithErrors, event, log, }OnErrorProps <HuaweiApiGatewayEvent , HuaweiApiGatewayResponse >

Returns:

void

(property) options

Signature:

protected readonly options?: HuaweiApiGatewayOptions | undefined;