console: redirect root to console

This commit is contained in:
Naeel
2026-04-27 10:51:41 +03:00
parent a11ac83baf
commit 7ba3cfa3af
3 changed files with 15 additions and 1 deletions
+7
View File
@@ -104,6 +104,13 @@ func NewServer(cfg Config) *Server {
// Разделено на публичные (без auth) и приватные (с authMiddleware).
func (s *Server) RegisterRoutes(mux *http.ServeMux) {
// Публичные: health checks, UI, auth endpoint
mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
if r.URL.Path != "/" {
http.NotFound(w, r)
return
}
http.Redirect(w, r, "/console/", http.StatusTemporaryRedirect)
})
mux.HandleFunc("/health", func(w http.ResponseWriter, _ *http.Request) {
w.Header().Set("Content-Type", "text/plain; charset=utf-8")
_, _ = w.Write([]byte("ok\n"))