#73 change authorization
All checks were successful
Build Docker Image / Explore-Gitea-Actions (push) Successful in 47s

This commit is contained in:
Tim
2024-08-25 22:25:32 +02:00
parent 4360d31bb2
commit 1f84a009f8
19 changed files with 589 additions and 187 deletions

View File

@@ -11,15 +11,21 @@ import (
func getHandler(db *sql.DB) http.Handler {
var router = http.NewServeMux()
router.HandleFunc("/", service.HandleIndexAnd404)
router.HandleFunc("/", service.HandleIndexAnd404(db))
// Serve static files (CSS, JS and images)
router.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.Dir("./static/"))))
router.HandleFunc("/app", service.App)
router.HandleFunc("POST /api/workout", service.NewWorkout(db))
router.HandleFunc("GET /api/workout", service.GetWorkouts(db))
router.HandleFunc("DELETE /api/workout", service.DeleteWorkout(db))
router.HandleFunc("/app", service.HandleWorkoutPage(db))
router.HandleFunc("POST /api/workout", service.HandleNewWorkout(db))
router.HandleFunc("GET /api/workout", service.HandleGetWorkouts(db))
router.HandleFunc("DELETE /api/workout/{id}", service.HandleDeleteWorkout(db))
router.HandleFunc("/auth/signin", service.HandleSignInPage(db))
router.HandleFunc("/auth/signup", service.HandleSignUpPage(db))
router.HandleFunc("/api/auth/signup", service.HandleSignUp(db))
router.HandleFunc("/api/auth/signin", service.HandleSignIn(db))
router.HandleFunc("/api/auth/signout", service.HandleSignOutComp(db))
return middleware.Logging(middleware.EnableCors(router))
}