A very basic Price API template for building simple Lambda functions in NodeJs using the Serverless Framework.
AWS
- Get AWS credentials with at least the permissions required for Serverless deployment
- Install AWS Cli tools
- Use aws configure to setup local credentials profile and region guide
Node and Serverless framework
- Guidance here
Setup the code
- Clone this repo
- Launch a terminal in the root folder
- Install all dependencies:
$ yarn install
$ yarn dynamodb-install
Run locally (browse to http://localhost:3000 to try the API)
$ yarn runlocal
Running unit tests:
$ yarn test
Running integration tests (requires running server; yarn runlocal
in other window):
$ yarn itest
Play with offline DynamoDB: http://localhost:8001/shell/
Deploying to AWS
$ yarn deploy
Remote tail of lambda functions running in AWS:
$ yarn taillog <functionName>
Note: The command serverless
can be used interchangeably with sls
for brevity.