[feature/backend] implement /users auth middleware

This commit is contained in:
CDN 2025-02-21 04:42:53 +08:00
parent a853374009
commit 823bedd1fa
Signed by: CDN
GPG key ID: 0C656827F9F80080

View file

@ -4,6 +4,7 @@ import (
"net/http" "net/http"
"strconv" "strconv"
"tss-rocks-be/internal/config" "tss-rocks-be/internal/config"
"tss-rocks-be/internal/middleware"
"tss-rocks-be/internal/service" "tss-rocks-be/internal/service"
"tss-rocks-be/internal/types" "tss-rocks-be/internal/types"
@ -37,7 +38,7 @@ func (h *Handler) RegisterRoutes(r *gin.Engine) {
} }
// User routes // User routes
users := api.Group("/users") users := api.Group("/users", middleware.AuthMiddleware(h.config.JWT.Secret))
{ {
users.GET("", h.ListUsers) users.GET("", h.ListUsers)
users.POST("", h.CreateUser) users.POST("", h.CreateUser)