Files
kouiz/internal/http/handler/webui/quiz/handler.go
2025-06-10 21:09:58 +02:00

32 lines
535 B
Go

package quiz
import (
"net/http"
"forge.cadoles.com/wpetit/kouiz/internal/store"
)
type Handler struct {
mux *http.ServeMux
store *store.Store
}
// ServeHTTP implements http.Handler.
func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
h.mux.ServeHTTP(w, r)
}
func NewHandler(store *store.Store) *Handler {
h := &Handler{
mux: http.NewServeMux(),
store: store,
}
h.mux.HandleFunc("GET /", h.getQuizPage)
h.mux.HandleFunc("POST /", h.handleQuizForm)
return h
}
var _ http.Handler = &Handler{}