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