- NodeJS 12.x
- NPM 6.x (usually preinstalled with the NodeJS)
-
Execute on the root directory, it will install necessary npm packages and the serverless
npm run start
├── README.md
├── jest-dynamodb-config.dynamic.js
├── jest-dynamodb-config.js (only use for running jest testing)
├── package-lock.json
└── package.json (nodejs related configs here)
├── serverless (Serverless config files goes below)
│ ├── dynamo.yml
│ ├── example
│ │ └── serverless.yml
│ ├── kms.yml
│ └── waf.yml
└── serverless.yml
├── src (Sourcecode for the lambda functions)
│ └── todos
│ ├── __tests__
│ │ ├── create.test.js
│ │ ├── delete.test.js
│ │ ├── get.test.js
│ │ ├── list.test.js
│ │ └── update.test.js
│ ├── create.js
│ ├── create.service.js
│ ├── delete.js
│ ├── delete.service.js
│ ├── dynamodb.js
│ ├── get.js
│ ├── get.service.js
│ ├── list.js
│ ├── list.service.js
│ ├── update.js
│ └── update.service.js
└── yarn.lock
-
Testing is ran using JEST, setup is automatic via jest code block inside package.json
-
Just need to run test
npm test
-
Note that the files must follow the structure above
-
Running this command will spawn a dynamodb + lambda http server at port 3000
npm run offline
its a syntatic sugar of, but i package everything inside the npm so easier to keep track
npx sls offline start
Serverless deployment currently spinning up few services below
-
Lambda (serving HTTPS requests)
-
Dynamodb (datastore)
-
WAFv2 (firewall and first layer security checks)
-
KMS (dynamodb encryption at rest
Yamls parked under .github folder for github actions Actions are split into three files
-
check
run security, vulnerability, and code quality checks
-
release development
run npm test and deploy to development environment if pass
-
release staging
release to staging environment for other stakeholders (biz / management)
github actions dependency on check + dev release
-
release production.
release to production environment (public/private). github actions dependency on check + staging release
-
package serverless-dynamodb-local cannot be started on 0.2.31
vulnerability detected at 0.2.30
stable currently at 0.2.40 fixed in the package.json