This repository has been archived on 2025-08-09. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
web-app-template/handler.go
Tim f826718c03
All checks were successful
Build Docker Image / Explore-Gitea-Actions (push) Successful in 47s
#73 begin implement keycloak
2024-08-25 21:52:35 +02:00

26 lines
695 B
Go

package main
import (
"me-fit/middleware"
"me-fit/service"
"database/sql"
"net/http"
)
func getHandler(db *sql.DB) http.Handler {
var router = http.NewServeMux()
router.HandleFunc("/", service.HandleIndexAnd404)
// Serve static files (CSS, JS and images)
router.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.Dir("./static/"))))
router.HandleFunc("/app", service.WorkoutIndex)
router.HandleFunc("POST /api/workout", service.NewWorkout(db))
// router.HandleFunc("GET /api/workout", service.GetWorkouts(db))
// router.HandleFunc("DELETE /api/workout", service.DeleteWorkout(db))
return middleware.Logging(middleware.Gzip(middleware.EnableCors(router)))
}