1
0
mirror of https://github.com/taigrr/log-socket synced 2026-03-20 14:52:27 -07:00
Files
log-socket/ws/namespaces.go
2025-11-10 16:07:28 -05:00

18 lines
419 B
Go

package ws
import (
"encoding/json"
"net/http"
logger "github.com/taigrr/log-socket/v2/log"
)
// NamespacesHandler returns a JSON list of all namespaces that have been used
func NamespacesHandler(w http.ResponseWriter, r *http.Request) {
namespaces := logger.GetNamespaces()
w.Header().Set("Content-Type", "application/json")
json.NewEncoder(w).Encode(map[string]interface{}{
"namespaces": namespaces,
})
}