Skip to content

Commit 87c1ef3

Browse files
sample() update samples
1 parent 4ca914e commit 87c1ef3

3 files changed

Lines changed: 9 additions & 13 deletions

File tree

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
export interface NestMiddleware<TRequest = any, TResponse = any> {
2-
use(req: TRequest, res: TResponse, next: Function);
2+
use(req: TRequest, res: TResponse, next: () => void);
33
}
Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
import { Injectable, NestMiddleware, MiddlewareFunction } from '@nestjs/common';
1+
import { Injectable, NestMiddleware } from '@nestjs/common';
22

33
@Injectable()
44
export class LoggerMiddleware implements NestMiddleware {
5-
resolve(context: string): MiddlewareFunction {
6-
return (req, res, next) => {
7-
console.log(`[${context}] Request...`);
8-
next();
9-
};
5+
use(req: any, res: any, next: () => void) {
6+
console.log(`[${context}] Request...`);
7+
next();
108
}
119
}
Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
import { Injectable, NestMiddleware, MiddlewareFunction } from '@nestjs/common';
1+
import { Injectable, NestMiddleware } from '@nestjs/common';
22

33
@Injectable()
44
export class LoggerMiddleware implements NestMiddleware {
5-
resolve(context: string): MiddlewareFunction {
6-
return (req, res, next) => {
7-
console.log(`[${context}] Request...`);
8-
next();
9-
};
5+
use(req: any, res: any, next: () => void) {
6+
console.log(`[${context}] Request...`);
7+
next();
108
}
119
}

0 commit comments

Comments
 (0)