1.0.8 • Published 1 month ago

@makemydeal/cai-api-version-manager v1.0.8

Weekly downloads
-
License
ISC
Repository
-
Last release
1 month ago

@makemydeal/cai-api-version-manager

This package will allow for header based routing/versioning in APIs. It will follow Cox API Cookbook standards listed here: https://ghe.coxautoinc.com/CoxAuto/api-cookbook/blob/master/cookbook-v2.md#8-api-versioning

Usage

In order to use this, you simply can instantiate a copy of the generic class CoxHeaderApiVersionManager or the API Gateway specific class ApiGatewayCoxApiVersionManager. The API Gateway specific class has an additional function to read ApiGatewayProxyEvent and determine the version.

Example

CoxHeaderApiVersionManager

    const versisonManager = new CoxHeaderApiVersionManager(DEFAULT_VERSION);
    const version = versionManager.read(httpMethod, headers);
    console.log(version);

ApiGatewayCoxAutoVersionManager

const handler: Handler<APIGatewayProxyEvent> = async (event, context): Promise<APIGatewayProxyResult> => {
    const versionManager = new ApiGatewayCoxApiVersionManager(DEFAULT_VERSION);
    const version = versionManager.readApiGateway(event);
    console.log(version);
}
1.0.8

1 month ago

1.0.7

2 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago