An open API service indexing awesome lists of open source software.

https://github.com/kenvilar/serverless-nodejs-lambda-config

Serverless Backend using Node.js on AWS Lambda with Serverless Framework
https://github.com/kenvilar/serverless-nodejs-lambda-config

aws aws-lambda nodejs serverless

Last synced: 10 months ago
JSON representation

Serverless Backend using Node.js on AWS Lambda with Serverless Framework

Awesome Lists containing this project

README

          

# serverless-nodejs-lambda-config

## Instruction
```
brew install awscli
npm install -g serverless

#deploy our first function
sls deploy
#invoke the lambda function, this will output "This is a test only"
sls invoke --function kenVilarFunction

#debug
sls invoke --function kenVilarFunction log

#alternative to sls invoke command
sls logs --function kenVilarFunction

#Redeploy the whole stack
sls deploy function --function kenVilarFunction
#this will output "This is a test only"
sls invoke --function kenVilarFunction

#since we've changed the configuration in the serverless.yml
sls deploy
curl
```

```
npm install --save uuid
```

## To store data
```curl
curl -X POST /todos --data '{"text": "My name is Ken Vilar"}'
```

## To retrieve data
```curl
curl /todos/
```
## To retrieve data with debug log (handy)
```
sls invoke --function getTodo --log --data '{"pathParameters": {"id": ""}}'
```