mirror of
https://github.com/cool-team-official/cool-admin-midway.git
synced 2026-01-09 05:18:17 +00:00
16 lines
414 B
TypeScript
16 lines
414 B
TypeScript
import { Provide } from '@midwayjs/decorator';
|
|
import { IWebMiddleware, IMidwayWebNext } from '@midwayjs/web';
|
|
import { Context } from 'egg';
|
|
|
|
@Provide()
|
|
export class ReportMiddleware implements IWebMiddleware {
|
|
|
|
resolve() {
|
|
return async (ctx: Context, next: IMidwayWebNext) => {
|
|
const startTime = Date.now();
|
|
await next();
|
|
console.log('请求时间', Date.now() - startTime);
|
|
};
|
|
}
|
|
|
|
} |