go-web-app-antipatterns icon indicating copy to clipboard operation
go-web-app-antipatterns copied to clipboard

Fix middleware order: Move Logger before Recoverer

Open stavhaygn opened this issue 2 years ago • 0 comments

This PR addresses an issue with the order of middleware in the router setup. According to the chi documentation, the Logger middleware should be placed before any other middleware that may change the response, such as Recoverer middleware. In the current implementation, the Logger middleware is placed after the Recoverer middleware, which may result in incorrect logging behavior.

Changes made:

  • Moved the Logger middleware before the Recoverer middleware in the router setup.

By making this change, the middleware order will now be in compliance with chi's recommendations, ensuring proper logging behavior.

stavhaygn avatar Mar 25 '23 10:03 stavhaygn