UNPKG

@kitmi/jacaranda

Version:

JavaScript application framework

45 lines (44 loc) 1.72 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "default", { enumerable: true, get: function() { return _default; } }); const _utils = require("@kitmi/utils"); const _ServiceContainer = /*#__PURE__*/ _interop_require_default(require("./ServiceContainer")); const _ModuleBase = /*#__PURE__*/ _interop_require_default(require("./ModuleBase")); const _Routable = /*#__PURE__*/ _interop_require_default(require("./Routable")); function _interop_require_default(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /** * Web application module class. * @class * @extends ModuleBase(Routable(ServiceContainer)) */ class WebModule extends (0, _ModuleBase.default)((0, _Routable.default)(_ServiceContainer.default)) { /** * @param {WebServer} server * @param {string} name - The name of the app module. * @param {string} route - The base route of the app module. * @param {string} appPath - The path to load the app's module files * @param {object} [options] - The app module's extra options defined in its parent's configuration. */ constructor(server, name, route, appPath, options){ super(server, name, appPath, options); this.server = this.host; this.router = this.server.engine.createModuleRouter(this); // after mounting, server will assign a new alias if duplicated this.alias = this.name; /** * Mounting route. * @member {string} */ this.route = _utils.text.ensureStartsWith(_utils.text.dropIfEndsWith(route, '/'), '/'); } } const _default = WebModule; //# sourceMappingURL=WebModule.js.map