express-audi-decorators
express decorators which utilize the aurelia-dependency-injection library
overview
This is a convience library to make creating routes for express REST services cleaner. It relies on the use of the aurelia-dependency-injection library to create instances of controllers.
getting started
$ npm install express-audi-decorators aurelia-dependency-injection
- Create models, business logic and any data access classes required
UserService.ts
;;
- Create your REST API
UserController.ts
;;;;
- Set up dependency injection container and start an HTTP listener
index.ts
;;;;; ;container.makeGlobal; // creates singleton instance of container // can register manually instantiated instances if desired // create express application; ; // register controllersregisterControllerapiRouter, UserController; app.use'/api', apiRouter; // run http listener;
- You should now have a useable api endpoint at:
localhost:8080/api/users/[id]