mirror of
https://github.com/fosrl/pangolin.git
synced 2026-03-04 01:36:39 +00:00
add log incoming middleware
This commit is contained in:
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();
|
||||
}
|
||||
Reference in New Issue
Block a user