2.1.2 • Published 5 years ago

mif v2.1.2

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

mif

Node.js modular framework for microservices

Main

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

Modules

Logger

this.logger - instance of winston req.logger - methods for logging in request

Priority: -1000

Validator

this.validator - instance of joi

Priority: -990

Auth

this.auth - hash of auth methods from dir ./auth

Priority: -980

Controllers

this.controllers - collections of controllers from dir ./controllers

Priority: -970

Routes

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

BaseServer

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).

WebServer

Priority: -900

AMQPServer

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

2.1.2

5 years ago

2.1.1

5 years ago

2.1.0

5 years ago

2.0.0

5 years ago

1.3.0

5 years ago

1.2.0

6 years ago

1.1.0

6 years ago

1.0.0

6 years ago

0.0.1

6 years ago