Init
This commit is contained in:
23
internal/auth/routes.go
Normal file
23
internal/auth/routes.go
Normal file
@@ -0,0 +1,23 @@
|
||||
package auth
|
||||
|
||||
import (
|
||||
"ResendIt/internal/api/middleware"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func RegisterRoutes(r *gin.RouterGroup, h *Handler) {
|
||||
auth := r.Group("/auth")
|
||||
|
||||
auth.POST("/login", h.Login)
|
||||
|
||||
protected := auth.Group("/")
|
||||
protected.Use(middleware.AuthMiddleware())
|
||||
|
||||
protected.GET("/me", h.Me)
|
||||
|
||||
admin := protected.Group("/")
|
||||
admin.Use(middleware.RequireRole("admin"))
|
||||
|
||||
admin.GET("/admin-check", h.AdminCheck)
|
||||
}
|
||||
Reference in New Issue
Block a user