vamtiger-serve-aws-lambda
A utility to serve aws lambda projects locally for integration testing.
Last updated 2 years ago by vamtiger-project .
MIT · Original npm · Tarball · package.json
$ cnpm install vamtiger-serve-aws-lambda 
SYNC missed versions from official npm registry.

VAMTIGER Serve AWS Lambda

A utility to serve aws lambda projects locally for debugging and integration testing.

Installation

VAMTIGER Serve AWS Lambda can be installed using npm or yarn:

npm i --save vamtiger-serve-aws-lambda # local
npm i --global vamtiger-serve-aws-lambda # global

or

yarn add vamtiger-serve-aws-lambda #local
yarn global vamtiger-serve-aws-lambda #global

Usage

VAMTIGER Serve AWS Lambda can be used to respond to requests inside lambda project:

# path/to/file.js
# export default lambda(event, context, callback)...
redblade-serve-lambda --port 8888 --path path/to/file.default

When using export default, the --path will be inferred from package.json:

{
    //...
    //...
    "main": "path/to/file"
    //...
    //...
}
redblade-serve-lambda --port 8888

A custom Request Handler can also be defined using the --handleRequest or -H option:

redblade-serve-lambda --port 8888 -H path/to/custom/request/handler

VAMTIGER Serve AWS Lambda can also be defined as an npm script:

// package.json
{
    //..
    "main": "path/to/file",
    "scripts": {
        "serve": "vamtiger-serve-aws-lambda -p 8888" // assuming default export of main
    }
    //..
}

All HTTP requests made will then locally invoke/debug lambda function:

const post = require('request-promise');
const params = {
    url: 'http://localhost:8888',
    body: {
        hello: 'world'
    },
    json: true
};

post(params)
    .then(handleResult)
    .catch(handleError);

Current Tags

  • 0.0.6                                ...           latest (2 years ago)

1 Versions

  • 0.0.6                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (3)
Dev Dependencies (12)
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |