feat: initial commit
This commit is contained in:
@ -14,6 +14,7 @@ type Handler struct {
|
||||
playInterval time.Duration
|
||||
playPeriod timex.PeriodType
|
||||
playDelay time.Duration
|
||||
offDays []time.Weekday
|
||||
}
|
||||
|
||||
// ServeHTTP implements http.Handler.
|
||||
@ -21,13 +22,14 @@ func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
h.mux.ServeHTTP(w, r)
|
||||
}
|
||||
|
||||
func NewHandler(store *store.Store, playInterval time.Duration, playPeriod timex.PeriodType, playDelay time.Duration) *Handler {
|
||||
func NewHandler(store *store.Store, playInterval time.Duration, playPeriod timex.PeriodType, playDelay time.Duration, offDays []time.Weekday) *Handler {
|
||||
h := &Handler{
|
||||
mux: http.NewServeMux(),
|
||||
store: store,
|
||||
playInterval: playInterval,
|
||||
playPeriod: playPeriod,
|
||||
playDelay: playDelay,
|
||||
offDays: offDays,
|
||||
}
|
||||
|
||||
h.mux.HandleFunc("GET /", h.getQuizPage)
|
||||
@ -35,6 +37,7 @@ func NewHandler(store *store.Store, playInterval time.Duration, playPeriod timex
|
||||
h.mux.HandleFunc("POST /select", h.handleSelectEntryForm)
|
||||
h.mux.HandleFunc("POST /answer", h.handleAnswerForm)
|
||||
h.mux.HandleFunc("GET /result", h.getResultPage)
|
||||
h.mux.HandleFunc("GET /history", h.getHistoryPage)
|
||||
|
||||
return h
|
||||
}
|
||||
|
Reference in New Issue
Block a user