3.0.6 • Published 4 years ago

node-serverless-helpers v3.0.6

Weekly downloads
873
License
ISC
Repository
github
Last release
4 years ago

Node Serverless Helpers

build codecov dependencies

Node Serverless Helpers is a package meant to make your life easier when developing lambda functions in NodeJS. It handles events seamlessly and adds useful defaults, helpers and functions to your project.

Documentation

The documentation can be found in the Wiki.

Usage

Install the package with npm or yarn.

npm install node-serverless-helpers
# or 
yarn add node-serverless-helpers

Here is a sample working code.

// handler.js
'use strict';

const handle = require('node-serverless-helpers').handle;

module.exports.helloWorld = handle(async (event) => {
    return 'hello lambda world!';
});
# serverless.yaml
service: hello-world

provider:
  name: aws
  runtime: nodejs8.10
  region: us-east-1

functions:
  hello:
    handler: handler.helloWorld
    events:
      - http:
          path: ''
          method: get

The important part is the handle function that does 3 things.

  1. Run the init function. You can register init handlers by calling the register function.
  2. Run the front controller. Its job is to figure out what source the event comes from, and add useful middlewares to it.
  3. Run your function, and wrap the result to the expected format.

TODO

  • Global logging system
  • Implement more handlers
  • Remove all console.logs

Licence

ISC - Copyright 2018 Thomas Ruiz

3.0.6

4 years ago

3.0.5

5 years ago

3.0.4

5 years ago

3.0.3

5 years ago

3.0.2

5 years ago

3.0.1

5 years ago

3.0.0

5 years ago

2.0.1

5 years ago

2.0.0

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

6 years ago

1.0.0-beta2

6 years ago

1.0.0-beta

6 years ago