/expense-management.backend

School project for SE114

Primary LanguageTypeScript

EXpressJS Base Source Apply DI With Inversify - Using Repository Pattern with TypeORM

  • Flow: Controller --> Service --> Repository --> TypeORM Entity

  • We combine all dependency in "container", then resolve and export the controller to use in routes

ORM: TypeORM

Usage

Development:

npm run start:dev

Production:

npm run build
npm run start:prod

Migration:

Auto genrate migration file to /src/database/migration

npm run migration:generate

Apply migration

npm run migration:start

Architecture

alt text

How to create new API Endpoint:

    1. Create new Entity Class in src/models
    1. Create new repository and its repository interface in src/repository
    1. Create new service and its service interface in src/service
    1. Create new controller and its controller interface in src/controller
    1. Combine all to container in src/container
    1. Create new route in src/route

Author

chabuuuu