#109 begin migration
Some checks failed
Build Docker Image / Explore-Gitea-Actions (push) Failing after 4s
Some checks failed
Build Docker Image / Explore-Gitea-Actions (push) Failing after 4s
This commit is contained in:
22
router.go
Normal file
22
router.go
Normal file
@@ -0,0 +1,22 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"api/middleware"
|
||||
"api/workout"
|
||||
"database/sql"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func getHandler(db *sql.DB) http.Handler {
|
||||
var router = http.NewServeMux()
|
||||
|
||||
static := http.FileServer(http.Dir("./static"))
|
||||
|
||||
router.Handle("/static", static)
|
||||
|
||||
router.HandleFunc("POST /workout", workout.NewWorkout(db))
|
||||
router.HandleFunc("GET /workout", workout.GetWorkouts(db))
|
||||
router.HandleFunc("DELETE /workout", workout.DeleteWorkout(db))
|
||||
|
||||
return middleware.Logging(middleware.EnableCors(router))
|
||||
}
|
||||
Reference in New Issue
Block a user