@fangcha/backend-kit
Version:
Backend Kit.
29 lines • 1.34 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.WebApp = void 0;
const main_1 = require("../main");
const HealthSpecs_1 = require("./retained-specs/HealthSpecs");
const _RouterState_1 = require("./_RouterState");
const RouterPlugin_1 = require("./RouterPlugin");
const JwtSessionSpecs_1 = require("./retained-specs/JwtSessionSpecs");
class WebApp extends main_1.FangchaApp {
constructor(protocol) {
super(protocol);
const routerApp = _RouterState_1._RouterState.routerApp;
if (protocol.mainDocItems) {
routerApp.addDocItem(...protocol.mainDocItems);
}
routerApp.addDocItem(HealthSpecs_1.HealthDocItem);
if (protocol.useJwtSpecs || protocol.routerOptions.jwtProtocol) {
routerApp.addDocItem(JwtSessionSpecs_1.JwtSessionSpecDocItem);
}
if (protocol.frontendConfig) {
main_1._FangchaState.updateFrontendConfig(protocol.frontendConfig);
}
this.routerPlugin = new RouterPlugin_1.RouterPlugin(Object.assign(Object.assign({}, protocol.routerOptions), { routerApp: routerApp }));
_RouterState_1._RouterState.routerPlugin = this.routerPlugin;
this.protocol.plugins = [this.routerPlugin, ...this.protocol.plugins];
}
}
exports.WebApp = WebApp;
//# sourceMappingURL=WebApp.js.map