mirror of
https://github.com/fosrl/pangolin.git
synced 2025-08-04 18:14:53 +02:00
add log incoming middleware
This commit is contained in:
parent
be144fe15d
commit
6cee5703b5
5 changed files with 124 additions and 109 deletions
14
server/middlewares/logIncoming.ts
Normal file
14
server/middlewares/logIncoming.ts
Normal file
|
@ -0,0 +1,14 @@
|
|||
import logger from "@server/logger";
|
||||
import { NextFunction, Request, Response } from "express";
|
||||
|
||||
export function logIncomingMiddleware(
|
||||
req: Request,
|
||||
res: Response,
|
||||
next: NextFunction
|
||||
) {
|
||||
const { method, url, headers, body } = req;
|
||||
if (url.includes("/api/v1")) {
|
||||
logger.debug(`${method} ${url}`);
|
||||
}
|
||||
next();
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue