feat(server): add request ID middleware

Add request ID middleware to trace requests through the system. The middleware checks for existing X-Request-ID headers, generates a new UUID if not present, and sets the ID in both request/response headers and Gin context.
This commit is contained in:
zenfun
2025-12-13 22:24:37 +08:00
parent 67df74e09a
commit a6b4306d08
2 changed files with 36 additions and 0 deletions

View File

@@ -121,6 +121,7 @@ func main() {
// 5. Setup Gin Router
r := gin.Default()
r.Use(middleware.RequestID())
// CORS Middleware
r.Use(func(c *gin.Context) {