Refactor the backend

This commit is contained in:
jiangrui
2025-03-11 17:42:59 +08:00
parent 615149c83f
commit 37c25a9307
23 changed files with 347 additions and 323 deletions

View File

@@ -1,10 +1,15 @@
import { Request, Response, NextFunction } from "express";
import { logger } from "../utils/logger";
const excludePaths = ["/tele-images/"];
export const requestLogger = () => {
return (req: Request, res: Response, next: NextFunction) => {
const start = Date.now();
res.on("finish", () => {
if (excludePaths.includes(req.path)) {
return;
}
const duration = Date.now() - start;
logger.info({
method: req.method,