2.1.5 • Published 3 years ago
@greenchic/api-utils v2.1.5
Serverless API Utils
Utility library for serverless lambda api
What's inside:
src/lambda.ts
:handlerPath
: a simple support method for resolve the path of a lambda- middlewares:
- logging
- error handler
- json parser
- cors
- validation
src/apiGateway.ts
: API response buildersrc/ssm.ts
: AWS Service Manager runtime resolverSlack.ts
: A super-simple Slack Integration
Usage
Simply install in your project with
npm i -S @greenchic/api-utils
To use, simply import like this
import {apiGateway, lambda} from '@greenchic/api-utils';
TODO: add more detailed usage of the middleware
Slack Log integration
Simply import in your project
import {Slack} from '@greenchic/api-utils';
Needs those environment variables:
SLACK_ENDPOINT
=> Mandatory: The channel slack webhookSLACK_LEVEL
=> Optional: The minimum level to be logged. DefaultERROR
SLACK_NAME
=> Optional: The name of the logger. Defaultgreenchic Slack Logger
SLACK_ICON
=> Optional: The icon of the logger. Default
Releasing a new version
Releasing a version is handled by node npm
.
This is the formalism, based on npm version
v1.2.3
where
v
is mandatory, since it's also generated automatically in minor releases1
is the major release2
is the minor release3
is the patch number
Simply use npm version major|minor|patch
according to your needs.
Keep in mind that the npm version patch
is handled automatically each push
TODOs
- The Lambda logger middleware must be enhanced to be working only with API Gateway's lambdas.
- The Lambda logger middleware must be enhanced to handle also responses