mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-08 07:10:56 +03:00
refactor(httpd): move every route under a new group
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
This commit is contained in:
committed by
Nicola Murino
parent
ac3bae00fc
commit
02ec3a5f48
@@ -22,6 +22,8 @@ func GetHTTPRouter() http.Handler {
|
|||||||
|
|
||||||
func initializeRouter(staticFilesPath string, enableProfiler, enableWebAdmin bool) {
|
func initializeRouter(staticFilesPath string, enableProfiler, enableWebAdmin bool) {
|
||||||
router = chi.NewRouter()
|
router = chi.NewRouter()
|
||||||
|
|
||||||
|
router.Group(func(router chi.Router) {
|
||||||
router.Use(middleware.RequestID)
|
router.Use(middleware.RequestID)
|
||||||
router.Use(middleware.RealIP)
|
router.Use(middleware.RealIP)
|
||||||
router.Use(logger.NewStructuredLogger(logger.GetLogger()))
|
router.Use(logger.NewStructuredLogger(logger.GetLogger()))
|
||||||
@@ -108,6 +110,7 @@ func initializeRouter(staticFilesPath string, enableProfiler, enableWebAdmin boo
|
|||||||
fileServer(router, webStaticFilesPath, http.Dir(staticFilesPath))
|
fileServer(router, webStaticFilesPath, http.Dir(staticFilesPath))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func handleCloseConnection(w http.ResponseWriter, r *http.Request) {
|
func handleCloseConnection(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|||||||
Reference in New Issue
Block a user