feat: initial commit

This commit is contained in:
2025-06-13 16:55:46 +02:00
parent 1fb753469e
commit 85f0bc1024
23 changed files with 11758 additions and 45 deletions

View File

@ -2,13 +2,15 @@ package quiz
import (
"net/http"
"time"
"forge.cadoles.com/wpetit/kouiz/internal/store"
)
type Handler struct {
mux *http.ServeMux
store *store.Store
mux *http.ServeMux
store *store.Store
playInterval time.Duration
}
// ServeHTTP implements http.Handler.
@ -16,10 +18,11 @@ func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
h.mux.ServeHTTP(w, r)
}
func NewHandler(store *store.Store) *Handler {
func NewHandler(store *store.Store, playInterval time.Duration) *Handler {
h := &Handler{
mux: http.NewServeMux(),
store: store,
mux: http.NewServeMux(),
store: store,
playInterval: playInterval,
}
h.mux.HandleFunc("GET /", h.getQuizPage)