Created
March 27, 2025 18:29
-
-
Save Vatsalya-singhi/f112b218b93ee345447b9d5ac654f5d8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Injectable, NestMiddleware } from '@nestjs/common'; | |
import { Request, Response, NextFunction } from 'express'; | |
@Injectable() | |
export class LoggerMiddleware implements NestMiddleware { | |
use(req: Request, res: Response, next: NextFunction) { | |
console.log(`[${new Date().toISOString()}] ${req.method} ${req.url}`); | |
next(); // Pass control to the next handler | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment