33 lines
620 B
Go

package issue
import (
"net/http"
"forge.cadoles.com/wpetit/clearcase/internal/core/service"
)
type Handler struct {
mux *http.ServeMux
forge *service.ForgeManager
}
// ServeHTTP implements http.Handler.
func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
h.mux.ServeHTTP(w, r)
}
func NewHandler(forge *service.ForgeManager) *Handler {
h := &Handler{
mux: http.NewServeMux(),
forge: forge,
}
h.mux.HandleFunc("GET /", h.getIssuePage)
h.mux.HandleFunc("PUT /", h.handleIssueSummaryForm)
h.mux.HandleFunc("POST /", h.handleIssueForm)
return h
}
var _ http.Handler = &Handler{}