add log incoming middleware

This commit is contained in:
Milo Schwartz 2024-10-26 17:19:10 -04:00
parent be144fe15d
commit 6cee5703b5
No known key found for this signature in database
5 changed files with 124 additions and 109 deletions

View 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();
}