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 111cd2daab
All checks were successful
Build Docker Image / Explore-Gitea-Actions (push) Successful in 47s
#73 copy sign in form from other branch and some renaming
2024-08-25 22:25:32 +02:00

28 lines
784 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.WorkoutPage)
router.HandleFunc("/auth/signin", service.SignInPage)
// router.HandleFunc("/auth/signup", service.SignUpPage)
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))
}