数据库插件

This commit is contained in:
robin
2022-05-31 08:34:53 +08:00
parent c764e7097d
commit 3494cecb9d
9 changed files with 171 additions and 9 deletions
+13 -2
View File
@@ -14,6 +14,7 @@ module.exports = class Bamboo extends Koa {
this.xe = xe
this.root = this.isPath() || root;
this.extend_directory = extend_directory || `extend/*/index.js`
this.willReadyList = []
console.log(`当前根目录${this.root}`);
console.log(`当前插件目录${this.extend_directory}`);
this.loadEvent()
@@ -25,7 +26,18 @@ module.exports = class Bamboo extends Koa {
for (let listElement of list) {
await listElement.res(this)
}
this.startServer()
this.willReadyList.push(()=>{
this.startServer()
})
await this.willReady()
}
/*扩展已经加载完成触发*/
async willReady() {
for (let WRL of this.willReadyList) {
WRL()
}
}
/*当前根目录*/
@@ -58,7 +70,6 @@ module.exports = class Bamboo extends Koa {
}
/*启动服务*/
startServer(prod) {
this.listen(prod || 3000)