19 lines
386 B
Go
19 lines
386 B
Go
package router
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"common/httpx"
|
|
"user/internal/handler"
|
|
)
|
|
|
|
func New(h *handler.Handler) http.Handler {
|
|
mux := http.NewServeMux()
|
|
mux.HandleFunc("/healthz", h.Healthz)
|
|
mux.HandleFunc("/version", h.Version)
|
|
mux.Handle("/", httpx.AuthRequired()(http.HandlerFunc(h.Root)))
|
|
mux.HandleFunc("/register", h.Register)
|
|
mux.HandleFunc("/login", h.Login)
|
|
return mux
|
|
}
|