This commit is contained in:
vipg
2026-02-09 17:50:39 +08:00
parent c7b11dca35
commit 2ae47c5049
4 changed files with 51 additions and 3 deletions

View File

@@ -89,5 +89,5 @@ func (h *Handler) Root(w http.ResponseWriter, r *http.Request) {
httpx.MethodNotAllowed(w, string(codes.MethodNotAllowed))
return
}
httpx.OK(w, map[string]string{"service": "user"})
httpx.OK(w, map[string]string{"service": "user", "user_id": httpx.UserID(r)})
}

View File

@@ -3,6 +3,7 @@ package router
import (
"net/http"
"common/httpx"
"user/internal/handler"
)
@@ -10,7 +11,7 @@ func New(h *handler.Handler) http.Handler {
mux := http.NewServeMux()
mux.HandleFunc("/healthz", h.Healthz)
mux.HandleFunc("/version", h.Version)
mux.HandleFunc("/", h.Root)
mux.Handle("/", httpx.AuthRequired()(http.HandlerFunc(h.Root)))
mux.HandleFunc("/register", h.Register)
mux.HandleFunc("/login", h.Login)
return mux