hackerank-backend-test
Conventions
File Name
We prefer hyphens (kebab-case) this-file-name vs underscores (snake_case) this_file_name
Development
Prerequisite
- VSCode
- Node LTS
Start development environment
Running app server directly on your local machine's environment
- Start your app server
npm start
# you might also want to migrate the DB with this command below
npm run migration:run
Testing
Prerequisite
- Node LTS
Run the test
npm test
Database migration
Before continuing, please learn about the fundamentals of migration with TypeORM here
On first time setting up the DB
Run migration
npm run migration:run
If you made new changes to the db
Modifying columns in entities, or adding new entities (migration file is a class, start with CapitalLetter) Please refer to 1571751456489-Init.ts for changes to be made to the migration file to satisfy linting rules
It's a good idea to generate a new migration for every atomic changes made to the db
Generate migration
npm run migration:generate -- -n <migration-name> # eg. add-disbursement-column
If you made a mistake on running migration
Revert will revert migration file by file
Revert migration
npm run migration:revert
If you need a manual migration
For eg you need to add new extensions or simply custom migration
Create migration
npm run migration:create -- -n <MigrationName>