refactor(httpd): move every route under a new group

Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
This commit is contained in:
Mark Sagi-Kazar
2020-10-29 02:06:54 +01:00
committed by Nicola Murino
parent ac3bae00fc
commit 02ec3a5f48

View File

@@ -22,6 +22,8 @@ func GetHTTPRouter() http.Handler {
func initializeRouter(staticFilesPath string, enableProfiler, enableWebAdmin bool) {
router = chi.NewRouter()
router.Group(func(router chi.Router) {
router.Use(middleware.RequestID)
router.Use(middleware.RealIP)
router.Use(logger.NewStructuredLogger(logger.GetLogger()))
@@ -108,6 +110,7 @@ func initializeRouter(staticFilesPath string, enableProfiler, enableWebAdmin boo
fileServer(router, webStaticFilesPath, http.Dir(staticFilesPath))
})
}
})
}
func handleCloseConnection(w http.ResponseWriter, r *http.Request) {