The project consists on a nodejs lambda connected to API gateway and dynamodb, using serverless to deployment process
- NodeJs & npm
- Docker (if you don't want to install JRE)
- Aws cli (if you want to deploy the project to your aws account)
-
We use serverless offline and dynamodb local, so we can run the lambda in local environment.
-
If you don't have JRE installed, we provide a docker to run the local environment. In the following steps it will be marked either
(docker)
or(JRE)
, so ignore the ones you are not following -
Install dependencies
npm install
- Run on development mode (JRE)
npm run install-dynamodb-local
npm start
- Run on development mode (docker)
docker-compose up --build
- Load fixtures (optional)
npm run migrations
- We also provide a simple postman collection that you can import, so it's easier to make the API requests
-
We are following the standard of writing tests in the same folder of the file itself. This means if you are going to write a test for
entityCreate.js
you should create a file namedentityCreate.spec.js
. -
To run the all the tests:
npm test
-
We are using serverless to both deploy and define the aws resources. So you need a user/role that has permissions to:
- create a S3 bucket to place the deployment files;
- create a dynamodb bucket;
- create a lambda and link it to cloudwatch;
-
Since all the resources are defined in the
serverless.yml
you just need to run
npm deploy