This commit is contained in:
ap 2021-02-19 23:16:53 +08:00
parent 36bdaf8739
commit a70aa31fa4

View File

@ -3,7 +3,7 @@ import { ILifeCycle, IMidwayContainer } from '@midwayjs/core';
import { Application } from 'egg'; import { Application } from 'egg';
import * as orm from '@midwayjs/orm'; import * as orm from '@midwayjs/orm';
import * as cool from 'midwayjs-cool-core'; import * as cool from 'midwayjs-cool-core';
import * as redis from 'midwayjs-cool-redis'; //import * as redis from 'midwayjs-cool-redis';
@Configuration({ @Configuration({
// 注意组件顺序 cool 有依赖orm组件 所以必须放在orm组件之后 cool的其他组件必须放在cool 核心组件之后 // 注意组件顺序 cool 有依赖orm组件 所以必须放在orm组件之后 cool的其他组件必须放在cool 核心组件之后
@ -12,7 +12,7 @@ import * as redis from 'midwayjs-cool-redis';
orm, orm,
// 必须,不可移除, cool-admin 官方组件 https://www.cool-js.com // 必须,不可移除, cool-admin 官方组件 https://www.cool-js.com
cool, cool,
redis //redis
] ]
}) })
@ -22,7 +22,9 @@ export class ContainerLifeCycle implements ILifeCycle {
app: Application; app: Application;
// 应用启动完成 // 应用启动完成
async onReady(container?: IMidwayContainer) { async onReady(container?: IMidwayContainer) {
//this.app.use(await this.app.generateMiddleware('reportMiddleware')); this.app.use(async (ctx, next)=>{
console.log('执行了')
});
} }
// 应用停止 // 应用停止
async onStop() { async onStop() {