Skip to content

xat/lambda-compose

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lambda-compose

lambda-compose adds middleware and promise support to your lambda functions.

installation

npm install lambda-compose

example

  const compose = require('lambda-compose')

  // example using callback
  export.myLambdaFunction = compose(
    (event, context, callback, next) => {
      // jump to next middleware:
      next()
    },
    (event, context, callback) => {
      // run the callback of the lambda function
      callback(null, { statusCode: 200, body: 'ok' })
    })

  // example using promises
  export.mySecondLambdaFunction = compose(
    (event, context, callback, next) => {
      // jump to next middleware:
      next()
    },
    (event, context) => Promise.resolve({ statusCode: 200, body: 'ok' })
  )

License

Copyright (c) 2017 Simon Kusterer Licensed under the MIT license.

About

lambda-compose adds middleware and promise support to your lambda functions.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published