The project features a widely used design pattern for structuring robust applications
src/
controllers/
dtos/
entities/
interfaces/
middlewares/
repos/
routes/
types/
utils/
validators/
/test
...
Here we leverage the package @ebukaodini/scaffoldjs
for scaffolding (see express-typescript-api-template)
To run project locally you need to follow the steps below;
- install dependencies
$ npm install
$ npm run build
- config database by setting the url to your postgres database in the
.env
file
DATABASE_URL="postgresql://groot:groot@localhost:5432/task-mgt?schema=public"
NODE_ENV=development
- Run migration
npm run migrate:db-dev
- Start up API server
npm run start:dev
To test this project follow the steps below;
- Update
.env.test
file to include your test database (postgres)
NODE_ENV=test
DATABASE_URL=""
- Setup test db
npm run preset
- Run tests
npm run test