Template of a simple serverless typescript api service with dynamodb
npx degit https://github.com/TheSmartMonkey/create-serverless-simple-ts-service serverless-ts-service
Changes to be done
-
package.json config name
-
serverless.ts service name
-
Change the region in
serverless.ts
provider/region (current region: Paris)
-
Install serverless framework : serverless framework Get Started
-
Setup your aws credentials : aws config
Create a cloud formation stack on aws : npm run deploy
Remove a cloud formation stack on aws : npm run undeploy
In order to test the lambda functions locally, after you have deployed the stack a first times for dependencies like dynamodb, run the following command:
npx sls invoke local -f hello --path src/functions/hello/mock.json
Check the sls invoke local command documentation for more information.
In serverless.ts put environment/OFFLINE to 'true'
Then run npm run offline
Your sls invoke local
commands now target your offline stack