Skip to content

Commit b169fac

Browse files
committed
fix: 修复一些问题
1 parent acd8765 commit b169fac

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/plugins/factory/Application.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,12 @@ module.exports = class Application extends Koa {
2121
constructor(api, info) {
2222
super();
2323

24+
// 根路由
25+
this.rootRouter = this[INIT_ROOT_ROUTER]();
2426
this.$api = this[CREATE_API](api);
2527
this.$config = this[CREATE_CONFIG](info);
2628
this.$lifecycle = this[CREATE_LIFECYCLE]();
2729

28-
// 根路由
29-
this.rootRouter = this[INIT_ROOT_ROUTER]();
30-
3130
// enhance context
3231
this.context.$config = this.$config;
3332
this.context.$api = this.$api;

src/plugins/factory/Lifecycle.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ const { tryRequire, _, logger } = require('@micro-app/shared-utils');
55
module.exports = class Lifecycle {
66
constructor(app) {
77
this.app = app;
8+
9+
this.__init__();
810
}
911

1012
// config(root) {
@@ -27,7 +29,7 @@ module.exports = class Lifecycle {
2729
// return this.__register__('plugin', root);
2830
// }
2931

30-
router(root) {
32+
__init__() {
3133
const app = this.app;
3234
const config = app.$config || {};
3335

@@ -45,7 +47,6 @@ module.exports = class Lifecycle {
4547
ctx.result(config.STATUS_CODES.StatusNotFound, 'Not Found');
4648
}
4749
});
48-
return this.__register__('router', root);
4950
}
5051

5152
__register__(name, root) {

0 commit comments

Comments
 (0)