Node.js modular framework for microservices
this.local
- hash for local data. Safe for own dev/user data
this.config
- hash of configs from dir ./config
this.modules
- hash of modules from dir ./modules
this.AppError
- Custom Error class. Can get object with properties code
, message
, details
this.env(keyPath, defaultValue)
- returns environment value. Also handle value that is JSON
this.getDirs()
- returns dirs paths
this.getDates()
- returns event dates
this.getStates()
- returns states of app
this.logger
- instance of winston
req.logger
- methods for logging in request
Priority: -1000
this.validator
- instance of joi
Priority: -990
this.auth
- hash of auth methods from dir ./auth
Priority: -980
this.controllers
- collections of controllers from dir ./controllers
Priority: -970
this.routes
- routes
this.modules.routes.selectRoute(req)
- Return matched route or throw error with code 404 or 405
this.modules.routes.appendReq(req, route)
- Append req object with necessary data (e.g. params)
Priority: -960
this.modules.*server.setPre(type, func)
- sets function for pre-event hook. Events: controller
, auth
, handler
, response
Hook-function for controller
gets (app, req)
.
Hook-function for auth
gets (app, req, controller)
.
Hook-function for handler
gets (app, req, controller)
.
Hook-function for response
gets (app, req, controller, response)
.
Priority: -900
this.services.request(serviceName, method, path, payload)
- make request to another service
this.services.publish(name, payload)
- publish message
req.services.request(serviceName, method, path, payload)
- make request to another service
req.services.publish(name, payload)
- publish message
Priority: -900