feat: 使用中间件 从 jwt 中获取用户信息
This commit is contained in:
10
src/commons/middleware/raw-body.middleware.ts
Normal file
10
src/commons/middleware/raw-body.middleware.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import { Injectable, NestMiddleware } from '@nestjs/common';
|
||||
import { raw } from 'body-parser';
|
||||
import { Request, Response, NextFunction } from 'express';
|
||||
|
||||
@Injectable()
|
||||
export class RawBodyMiddleware implements NestMiddleware {
|
||||
use(req: Request, res: Response, next: NextFunction) {
|
||||
raw({ type: '*/*' })(req, res, next);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user