typescript-lambda-serverless-boilerplate v1.0.0
typescript-lambda-boilerplate
AWS Lambda function boilerplate with TypeScript. It will give you a head start on building AWS lambda with TypeScript. Please make sure to add the custom_config with your AWS account information as in step 2 of the Setup section.
The example function simply retrieves data from an API endpoint and return it from API gateway.
serverless-webpack plugin enables transiplation through webpack before deployment. Once webpack & tsconfig are set, everything works like JavaScript (see the JavaScript lambda boilerplate).
Setup
(1) Install all modules
npm i
Running Test
It uses mocha for unit & integration tests. Istanbul for coverage.
# unit test
npm test
# integration test
npm run integration
Deployment
Use npm command and we can pass arguments as below. Alternatively, we can use sls deploy command.
npm run deploy -- -stage nonprod
sls deploy -stage nonprod
Checking endpoint
curl -H "x-api-key: <api key" -X GET https://url
Reference
Tools
Configuration & Miscellaneous Reference
4 years ago