@mvx/mvc
Version:
@mvx/mvc is mvc framework on server, base on koa, @tsdi frameworks
79 lines (77 loc) • 2.33 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.MvcContext = exports.MvcContextToken = void 0;
var tslib_1 = require("tslib");
var ioc_1 = require("@tsdi/ioc");
var boot_1 = require("@tsdi/boot");
var platform_server_1 = require("@tsdi/platform-server");
var Koa = require("koa");
/**
* mvc context token.
*/
exports.MvcContextToken = ioc_1.tokenId('MVC_CONTEXT');
/**
* mvc application context.
*
* @export
* @class MvcContext
* @extends {BootContext}
*/
var MvcContext = /** @class */ (function (_super) {
tslib_1.__extends(MvcContext, _super);
function MvcContext() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* boot startup service instance.
*
* @type {IStartup}
* @memberof BootContext
*/
MvcContext.prototype.getStartup = function () {
return _super.prototype.getStartup.call(this);
};
MvcContext.prototype.getAnnoation = function () {
return _super.prototype.getAnnoation.call(this);
};
/**
* configuration, meger configure and annoation metadata.
*
* @type {IConfiguration}
* @memberof MvcContext
*/
MvcContext.prototype.getConfiguration = function () {
return _super.prototype.getConfiguration.call(this);
};
/**
* get configure manager.
*
* @returns {ConfigureManager<IConfiguration>}
* @memberof BootContext
*/
MvcContext.prototype.getConfigureManager = function () {
return _super.prototype.getConfigureManager.call(this);
};
MvcContext.prototype.getKoa = function () {
if (!this.koa) {
this.koa = new Koa();
}
return this.koa;
};
MvcContext.prototype.getRootPath = function () {
if (this.baseURL) {
return this.baseURL;
}
return this.getContainer().get(boot_1.ProcessRunRootToken) || platform_server_1.runMainPath();
};
MvcContext.ρAnn = function () {
return { "name": "MvcContext", "params": {} };
};
MvcContext = tslib_1.__decorate([
ioc_1.Injectable(),
ioc_1.Refs('@MvcModule', boot_1.BootContext)
], MvcContext);
return MvcContext;
}(boot_1.BootContext));
exports.MvcContext = MvcContext;
//# sourceMappingURL=sourcemaps/MvcContext.js.map