mirror of
https://github.com/jiangrui1994/CloudSaver.git
synced 2026-01-12 16:18:45 +08:00
Refactor the backend
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user