- 1. Introduction
- 2. Pre-requirement
- 3. Running the project
- 4. Connect to container
- 5. Db operations
- 6. Test Cases
- 7. Health check apis
- 8. Cron
- 9. cors
- 10. Authors/maintainers/contributors
It's backend project build on nodejs. which can be used as a reference/based for new/existing project.
- Ubuntu 20.04.4 LTS
- docker(19.xx)
- docker-compose(1.28.xx)
docker-compose up
To perform db operations, installing new packages and running test cases. You need to connect to the container. use below cmd to connect.
./connect.sh
To perform db operations connect to the container and execute below commends. Note: <:env> should be your environment name like dev,test or qa etc
Commands:
npm run db:create --env=<:env> Create database specified by configuration
npm run db:migrate --env=<:env> Run pending migrations
npm run db:migrate:undo --env=<:env> Reverts a migration
npm run db:seed:all --env=<:env> Run every **seeder**
npm run model:generate --name=<modelName> --attributes=<listOfAttributes> Generates a new migration file
npm run migration:generate --name=<migrationName> Generates a model and its migration
npm run db:drop --env=<:env> Drop database specified by configuration(Note: all connections are closed)
To execute test cases connect to the container and execute below commends
npm run test:watch Run all the test cases and wait for the changes
npm run test Run all the test cases and exit
docker-compose -p tests run -p 3000 --rm web npm run test:watch
Project contain two health-check api end-points.
/health-check-api To check the health of api instance.
/health-check-db To check the connection between api instance and db.
Note: check index.js for code implementation.
For cron related works, Project use cron package for running your code and cronitor package to monitoring your cron.
cron installation npm i cron
How to use : https://www.npmjs.com/package/cron
Pre-requirement: Create account in cronitor portal (https://cronitor.io/)
cronitor installation npm i cronitor
- Site url: https://github.com/cronitorio/cronitor-js
- Implementation Walkthrough video: https://drive.google.com/file/d/1mVzH_NAFFLWvkebK6v2ce8ADQOB8KCtO/view?usp=drivesdku
cors installation npm i cors
How to use : https://www.npmjs.com/package/cors
- Yashjeet Luthra (yash@napses.com)
- Hitesh Bhati (hitesh.bhati@napses.com)
- Priyansh (priyansh.jain@napses.com)