UNPKG

silentjs

Version:
29 lines (25 loc) 908 B
// VENDOR LIBS var path = require('path'); // FRAMEWORK var App = require('silentjs/app'); var appService = require('silentjs/services/app-service'); var configurationService = require('silentjs/configuration'); var middlewareService = require('silentjs/services/middleware-service'); module.exports = { init: function () { middlewareService.loadMiddlewares(path.join(configurationService.get('frameworkPath'), 'middlewares')); }, app: function (appId, config) { var app = appService.getApp(appId); if (!app) { app = new App(appId, config); } return app; }, service: function (serviceName) { return require(path.join(configurationService.get('frameworkPath'), 'services', serviceName + '-service')); }, middleware: function (middlewareId, func) { middlewareService.addMiddleware(middlewareId, func); } };