diff --git a/server/handlers.go b/server/handlers.go index 686b3e7..d89bc57 100644 --- a/server/handlers.go +++ b/server/handlers.go @@ -2,13 +2,15 @@ package server import ( lib "com.navi.medici.janus/lib" + producer "com.navi.medici.janus/producer" "io" // "fmt" + // "log" "io/ioutil" - "log" "net/http" "compress/gzip" + "encoding/json" ) var ( @@ -100,3 +102,10 @@ func healthToggleHandler(w http.ResponseWriter, r *http.Request) { healthyBool = !healthyBool io.WriteString(w, "toggled") } + + +func getSchemaHandler(w http.ResponseWriter, r *http.Request) { + schemaMapJson, _ := json.Marshal(producer.SchemaVersionMap) + w.Header().Set("Content-Type", "application/json") + w.Write(schemaMapJson) +} \ No newline at end of file diff --git a/server/server.go b/server/server.go index ab700c3..f9aadb0 100644 --- a/server/server.go +++ b/server/server.go @@ -34,6 +34,7 @@ func NewServer(port string) (*Server, error) { router.HandleFunc("/events/json", eventsHandlerJson).Methods("POST") router.HandleFunc("/health", healthHandler).Methods("GET") router.HandleFunc("/health/toggle", healthToggleHandler).Methods("GET") + router.HandleFunc("/schema/get", getSchemaHandler).Methods("GET") // router.HandleFunc("/test", testHandler).Methods("GET") // router.HandleFunc("/schema/refresh", schemaRefreshHandler).Methods("POST") // router.HandleFunc("/stop", stopHandler).Methods("POST")