Adekabang 8eaee0be8c refactor: update project references from Adekabang to khairul169
- Change Docker image references in docker-compose.yml and documentation
- Update Go module path and import statements in backend code
- Modify build script to reflect new image name
- Remove outdated copyright information from LICENSE file
2025-09-29 20:26:44 -04:00

36 lines
946 B
Go

package router
import (
"khairul169/garage-webui/middleware"
"net/http"
)
func HandleApiRouter() *http.ServeMux {
mux := http.NewServeMux()
auth := &Auth{}
mux.HandleFunc("POST /auth/login", auth.Login)
router := http.NewServeMux()
router.HandleFunc("POST /auth/logout", auth.Logout)
router.HandleFunc("GET /auth/status", auth.GetStatus)
config := &Config{}
router.HandleFunc("GET /config", config.GetAll)
buckets := &Buckets{}
router.HandleFunc("GET /buckets", buckets.GetAll)
browse := &Browse{}
router.HandleFunc("GET /browse/{bucket}", browse.GetObjects)
router.HandleFunc("GET /browse/{bucket}/{key...}", browse.GetOneObject)
router.HandleFunc("PUT /browse/{bucket}/{key...}", browse.PutObject)
router.HandleFunc("DELETE /browse/{bucket}/{key...}", browse.DeleteObject)
// Proxy request to garage api endpoint
router.HandleFunc("/", ProxyHandler)
mux.Handle("/", middleware.AuthMiddleware(router))
return mux
}