#109 switch svelte to SSR with go
All checks were successful
Build Docker Image / Explore-Gitea-Actions (push) Successful in 46s

This commit is contained in:
Tim
2024-08-21 23:33:06 +02:00
parent 69b8efc8b9
commit 9c7d7e2cb3
53 changed files with 1796 additions and 6353 deletions

25
handler.go Normal file
View File

@@ -0,0 +1,25 @@
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.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))
return middleware.Logging(middleware.EnableCors(router))
}