Skip to content

Commit

Permalink
Add request ID middleware (#174)
Browse files Browse the repository at this point in the history
  • Loading branch information
AmirAgassi authored Dec 16, 2024
2 parents ca2ff30 + a47cdee commit 2832c79
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
11 changes: 11 additions & 0 deletions backend/internal/middleware/request_id.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package middleware

import (
"github.com/labstack/echo/v4"
"github.com/labstack/echo/v4/middleware"
)

// RequestID returns a middleware that adds a request ID to the request context
func RequestID() echo.MiddlewareFunc {
return middleware.RequestID()
}
6 changes: 5 additions & 1 deletion backend/internal/server/middleware.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
package server

import (
"KonferCA/SPUR/internal/middleware"
)

/*
Setup all the global middlewares used in the server.
*/
func (s *Server) setupMiddlewares() {

s.Echo.Use(middleware.RequestID())
}

0 comments on commit 2832c79

Please sign in to comment.