2.1.5 • Published 3 years ago

@greenchic/api-utils v2.1.5

Weekly downloads
-
License
ISC
Repository
bitbucket
Last release
3 years ago

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 builder
  • src/ssm.ts: AWS Service Manager runtime resolver
  • Slack.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 webhook
  • SLACK_LEVEL => Optional: The minimum level to be logged. Default ERROR
  • SLACK_NAME => Optional: The name of the logger. Default greenchic Slack Logger
  • SLACK_ICON => Optional: The icon of the logger. Default npm.io

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 releases
  • 1 is the major release
  • 2 is the minor release
  • 3 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
2.1.5

3 years ago

2.1.4

3 years ago

2.1.1

3 years ago

2.0.2

3 years ago

2.0.1

3 years ago

1.2.4

3 years ago

1.3.2

3 years ago

1.3.1

3 years ago

1.2.3

3 years ago

1.2.2

3 years ago

1.1.7

3 years ago

1.1.6

3 years ago

1.1.5

3 years ago