UNPKG

2.7 kBMarkdownView Raw
1# node-lambda
2
3![node-lambda](../master/node-lambda.png?raw=true)
4
5Command line tool to locally run and deploy your node.js application to [Amazon Lambda](http://aws.amazon.com/lambda/).
6
7[![BuildStatus](https://travis-ci.org/RebelMail/node-lambda.png?branch=master)](https://travis-ci.org/motdotla/node-lambda)
8[![NPM version](https://badge.fury.io/js/node-lambda.png)](http://badge.fury.io/js/node-lambda)
9
10```
11node-lambda run
12```
13
14## Installation
15
16```
17npm install -g node-lambda
18```
19
20## Example App
21
22The [node-lambda-template](https://github.com/RebelMail/node-lambda-template) example app makes it easy to get up and running.
23
24## Usage
25
26There are 3 available commands.
27
28```
29node-lambda setup
30node-lambda run
31node-lambda deploy
32```
33
34### Commands
35
36#### setup
37
38Initializes the `event.json` and `.env` files. `event.json` is where you mock your event. `.env.` is where you place your deployment configuration.
39
40```
41$ node-lambda setup --help
42
43 Usage: run [options]
44
45 Options:
46
47 -h, --help output usage information
48```
49
50After running setup, it's a good idea to gitignore the generated `event.json` and `.env` file.
51
52```
53echo ".env\nevent.json" >> .gitignore
54```
55
56#### run
57
58Runs your Amazon Lambda index.js file locally. Passes `event.json` data to the Amazon Lambda event object.
59
60```
61$ node-lambda run --help
62
63 Usage: run [options]
64
65 Options:
66
67 -h, --help output usage information
68 -h, --handler [index.handler] Lambda Handler {index.handler}
69```
70
71#### deploy
72
73Bundles and deploys your application up to Amazon Lambda.
74
75```
76$ node-lambda deploy --help
77
78 Usage: deploy [options]
79
80 Options:
81
82 -h, --help output usage information
83 -e, --environment [staging] Choose environment {development, stating, production}
84 -a, --accessKey [your_key] AWS Access Key
85 -s, --secretKey [your_secret] AWS Secret Key
86 -r, --region [us-east-1] AWS Region
87 -n, --functionName [node-lambda] Lambda FunctionName
88 -h, --handler [index.handler] Lambda Handler {index.handler}
89 -m, --mode [event] Lambda Mode
90 -o, --role [your_role] Amazon role
91 -m, --memorySize [128] Lambda Memory Size
92 -t, --timeout [3] Lambda Timeout
93 -d, --description [missing] Lambda Description
94 -u, --runtime [nodejs] Lambda Runtime
95```
96
97## Contributing
98
991. Fork it
1002. Create your feature branch (`git checkout -b my-new-feature`)
1013. Commit your changes (`git commit -am 'Added some feature'`)
1024. Push to the branch (`git push origin my-new-feature`)
1035. Create new Pull Request
104
105## Running tests
106
107```
108npm install
109npm test
110```