mirror of
https://github.com/muety/wakapi.git
synced 2023-08-10 21:12:56 +03:00
chore: move route registration into the handler classes themselves (resolve #57)
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
package routes
|
||||
|
||||
import (
|
||||
"github.com/gorilla/mux"
|
||||
conf "github.com/muety/wakapi/config"
|
||||
"github.com/muety/wakapi/models"
|
||||
"github.com/muety/wakapi/models/view"
|
||||
@ -21,6 +22,14 @@ func NewSummaryHandler(summaryService services.ISummaryService) *SummaryHandler
|
||||
}
|
||||
}
|
||||
|
||||
func (h *SummaryHandler) RegisterRoutes(router *mux.Router) {
|
||||
router.Methods(http.MethodGet).HandlerFunc(h.GetIndex)
|
||||
}
|
||||
|
||||
func (h *SummaryHandler) RegisterAPIRoutes(router *mux.Router) {
|
||||
router.Methods(http.MethodGet).HandlerFunc(h.ApiGet)
|
||||
}
|
||||
|
||||
func (h *SummaryHandler) ApiGet(w http.ResponseWriter, r *http.Request) {
|
||||
summary, err, status := h.loadUserSummary(r)
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user