package http import ( "net/http" "github.com/go-chi/chi/v5" ) // RegisterRoutes registers HTTP routes onto the router func RegisterRoutes(r *chi.Mux, app *App) { r.Use(Logging) r.Use(RequestID) r.Use(Auth) r.Get("/", app.DashboardHandler) r.Get("/dashboard", app.DashboardHandler) r.Get("/healthz", func(w http.ResponseWriter, r *http.Request) { w.WriteHeader(http.StatusOK) }) // API namespace r.Route("/api", func(r chi.Router) { r.Get("/pools", app.PoolsHandler) r.With(RBAC("storage.pool.create")).Post("/pools", app.CreatePoolHandler) // create a pool -> creates a job r.Get("/jobs", app.JobsHandler) }) r.Get("/storage", app.StorageHandler) r.Get("/hx/pools", app.HXPoolsHandler) r.Post("/storage/pool/create", app.StorageCreatePoolHandler) r.Get("/jobs/{id}", app.JobPartialHandler) r.Get("/static/*", StaticHandler) }