diff --git a/backend/internal/middleware/request_id.go b/backend/internal/middleware/request_id.go new file mode 100644 index 00000000..06594af6 --- /dev/null +++ b/backend/internal/middleware/request_id.go @@ -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() +} \ No newline at end of file diff --git a/backend/internal/server/middleware.go b/backend/internal/server/middleware.go index f9c12b67..2fa1028a 100644 --- a/backend/internal/server/middleware.go +++ b/backend/internal/server/middleware.go @@ -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()) }