fix: restructure handler yet again #181
All checks were successful
Build Docker Image / Explore-Gitea-Actions (push) Successful in 45s

This commit is contained in:
2024-09-17 22:47:54 +02:00
parent 2f7081c0fe
commit 3136f587eb
5 changed files with 79 additions and 10 deletions

View File

@@ -7,9 +7,20 @@ import (
"net/http"
)
func handleWorkout(db *sql.DB, router *http.ServeMux) {
router.Handle("/workout", auth(db, service.HandleWorkoutPage(db)))
router.Handle("POST /api/workout", auth(db, service.HandleWorkoutNewComp(db)))
router.Handle("GET /api/workout", auth(db, service.HandleWorkoutGetComp(db)))
router.Handle("DELETE /api/workout/{id}", auth(db, service.HandleWorkoutDeleteComp(db)))
func workoutUi(db *sql.DB) http.Handler {
router := http.NewServeMux()
router.Handle("/workout", service.HandleWorkoutPage(db))
return router
}
func workoutApi(db *sql.DB) http.Handler {
router := http.NewServeMux()
router.Handle("POST /api/workout", service.HandleWorkoutNewComp(db))
router.Handle("GET /api/workout", service.HandleWorkoutGetComp(db))
router.Handle("DELETE /api/workout/{id}", service.HandleWorkoutDeleteComp(db))
return router
}