chore(auth): add service structs and test error handling
All checks were successful
Build Docker Image / Explore-Gitea-Actions (push) Successful in 49s

This commit is contained in:
2024-09-20 22:19:02 +02:00
parent 7e3e9388e2
commit e53a0e5cf7
4 changed files with 130 additions and 99 deletions

View File

@@ -13,13 +13,18 @@ import (
func GetHandler(db *sql.DB) http.Handler {
router := http.NewServeMux()
router.HandleFunc("/$", handleIndex(db))
router.HandleFunc("/{$}", handleIndex(db))
router.HandleFunc("/", handleNotFound(db))
router.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.Dir("./static/"))))
router.Handle("/auth/", authUi(db))
router.Handle("/api/auth/", authApi(db))
authHandler := AuthHandler{
db: db,
service: service.NewAuthService(db),
}
router.Handle("/auth/", authHandler.authUi())
router.Handle("/api/auth/", authHandler.authApi())
router.Handle("/workout", authMiddleware(db, workoutUi(db)))
router.Handle("/api/workout", authMiddleware(db, workoutApi(db)))