Periodically, it will be wise to update the package versions specified in the package.json file. Do this by creating a local sam project from this cookie cutter using the sam init command below, and then manually updating the versions using
npm uninstall yada
npm install --save-dev yada
etc...
sam local generate-event apigateway aws-proxy | pbcopy
to see supported events
sam local generate-event -h
The following files must be modified to add additional lambda functions.
template.yml
SecondFunction:
Type: AWS::Serverless::Function
Metadata:
BuildMethod: makefile
Properties:
Handler: dist/handlers/second.secondHandler
Description: A second function built on top of the same infrastructure.
Events:
Api:
Type: Api
Properties:
Path: /second
Method: GET
src/handlers/second.ts
export const secondHandler = async ( ... ) { ... }
Makefile
build-SecondFunction:
$(MAKE) HANDLER=src/handlers/second.ts build-lambda-common
This is a Cookiecutter template to create a Serverless application based on Serverless Application Model (SAM) on Node.js 14 runtime using TypeScript for Lambda functions source code and shared layers for runtime dependencies.
Resulted application will be close to this example app: aws-sam-typescript-layers-example
Install AWS SAM CLI and run following command:
sam init --location gh:Envek/cookiecutter-aws-sam-typescript-layers
You'll be prompted a few questions to help this template to scaffold this project and after its completion you should see a new folder at your current path with the name of the project you gave as input.
This project is licensed under the terms of the MIT license.