feat: initial commit
This commit is contained in:
31
internal/http/handler/webui/quiz/handler.go
Normal file
31
internal/http/handler/webui/quiz/handler.go
Normal file
@ -0,0 +1,31 @@
|
||||
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{}
|
Reference in New Issue
Block a user