27 lines
537 B
Go
27 lines
537 B
Go
package handler
|
|
|
|
import (
|
|
"me-fit/service"
|
|
|
|
"database/sql"
|
|
"net/http"
|
|
)
|
|
|
|
func workoutUi(db *sql.DB) http.Handler {
|
|
router := http.NewServeMux()
|
|
|
|
router.Handle("/workout", service.HandleWorkoutPage(db))
|
|
|
|
return router
|
|
}
|
|
|
|
func workoutApi(db *sql.DB) http.Handler {
|
|
router := http.NewServeMux()
|
|
|
|
router.Handle("POST /api/workout", service.HandleWorkoutNewComp(db))
|
|
router.Handle("GET /api/workout", service.HandleWorkoutGetComp(db))
|
|
router.Handle("DELETE /api/workout/{id}", service.HandleWorkoutDeleteComp(db))
|
|
|
|
return router
|
|
}
|