MW usage refactor
This commit is contained in:
parent
229eebcf66
commit
21b54c4167
9 changed files with 98 additions and 48 deletions
|
|
@ -4,6 +4,7 @@ import (
|
|||
"github.com/gin-gonic/gin"
|
||||
"merch-api/internal/appLog"
|
||||
"merch-api/pkg/responses"
|
||||
"merch-api/pkg/router"
|
||||
"merch-api/pkg/utils"
|
||||
"net/http"
|
||||
)
|
||||
|
|
@ -22,11 +23,11 @@ func newController(s *service, utils utils.Utils) *controller {
|
|||
}
|
||||
}
|
||||
|
||||
func (h *Handler) RegisterRoutes(r *gin.RouterGroup) {
|
||||
func (h *Handler) RegisterRoutes(r *gin.RouterGroup, mw *router.Middlewares) {
|
||||
userGroup := r.Group("/user")
|
||||
|
||||
userGroup.POST("", h.controller.create)
|
||||
userGroup.DELETE("", h.controller.delete)
|
||||
userGroup.POST("", mw.RegMW, h.controller.create)
|
||||
userGroup.DELETE("", mw.AuthMW, h.controller.delete)
|
||||
}
|
||||
|
||||
// create godoc
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue