A Serverless starter kit with a node.js runtime that supports serverless offline, environment variables, function warmup (optimized cold starts), ES7 syntax, linting, authorizers, and RESTful endpoint support. Built with AWS in mind.
This repo uses the serverless framework, an open source toolkit for deploying and operating serverless architectures. This starter kit is assuming the use of AWS Lambda to run event-driven compute services. Additional documentation is available at https://serverless.com/framework/docs/providers/aws/guide/intro/.
This requires Node.js v8+ to run.
Install the dependencies and start the server.
npm install
npm start
Open your terminal and paste in the following:
curl -X POST \
http://localhost:3000/api/v1/handler \
-H 'Authorization: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7InVzZXJJZCI6MTIzLCJuYW1lIjoiSm9uIERvZSIsInJvbGUiOiJVU0VSIn19.aNR5NIfzYQ5SJTlO4Pxef87V0dpc2TU8Z4mle_smM9Q' \
-H 'Cache-Control: no-cache' \
-H 'Content-Type: application/json' \
-d '{
"name": "Test"
}'
serverless deploy --stage $STAGE_NAME
If your functions are being deployed to a VPC, in order for warmUp to properly work:
- Go to https://console.aws.amazon.com/lambda.
- Add VPCs that allow outgoing internet access to the warmup function.
If this is not done, your functions will not stay warm!
npm run lint:fix
- Support unit tests
- Environment configuration support