get schema versions
This commit is contained in:
@@ -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)
|
||||
}
|
||||
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user