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
Parameter | Type | Description |
---|---|---|
options | HuaweiApiGatewayOptions | undefined | (Optional) The options to customize the HuaweiApiGatewayAdapter |
(method) canHandle
Signature:
canHandle(event: unknown): event is HuaweiApiGatewayEvent;
Parameters
Parameter | Type | Description |
---|---|---|
event | unknown |
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
Parameter | Type | Description |
---|---|---|
event | HuaweiApiGatewayEvent | The event sent by serverless |
Returns:
string
(method) getRequest
Signature:
getRequest(event: HuaweiApiGatewayEvent): AdapterRequest;
Parameters
Parameter | Type | Description |
---|---|---|
event | HuaweiApiGatewayEvent |
Returns:
(method) getResponse
Signature:
getResponse(\{ headers: responseHeaders, body, isBase64Encoded, statusCode, }: GetResponseAdapterProps<HuaweiApiGatewayEvent>): HuaweiApiGatewayResponse;
Parameters
Parameter | Type | Description |
---|---|---|
{ headers: responseHeaders, body, isBase64Encoded, statusCode, } | GetResponseAdapterProps <HuaweiApiGatewayEvent > |
Returns:
(method) onErrorWhileForwarding
Signature:
onErrorWhileForwarding(\{ error, delegatedResolver, respondWithErrors, event, log, }: OnErrorProps<HuaweiApiGatewayEvent, HuaweiApiGatewayResponse>): void;
Parameters
Parameter | Type | Description |
---|---|---|
{ error, delegatedResolver, respondWithErrors, event, log, } | OnErrorProps <HuaweiApiGatewayEvent , HuaweiApiGatewayResponse > |
Returns:
void
(property) options
Signature:
protected readonly options?: HuaweiApiGatewayOptions | undefined;