a Node + Express -REST service with typescript using classes and inheritance.
- Clone repo
- run
npm install
- Add
.env
-file, with contentPORT=7000
- Invoke the webpack script to create the bundle:
npm run webpack
- Then in a separate terminal, start script to run the bundle:
npm start
index.ts uses App class to create the express app and configure it. Controllers are injected to App that will call configure() on them. configure() contains all express route configurations for every controller.
There is a default implementation in BaseController. Default implementation uses generic Repository, that has simple CRUD functions to save and get data. This app uses in memory array to store and get data.
To add a CRUD functionality to any new object, create new Controller that inherits BaseController and add that controller to controllers/index.ts.