refactored code to breakdown init function, moved schema_util outside producer module, renamed files
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
package server
|
||||
|
||||
import (
|
||||
lib "com.navi.medici.janus/lib"
|
||||
producer "com.navi.medici.janus/producer"
|
||||
"com.navi.medici.janus/lib"
|
||||
"com.navi.medici.janus/schema"
|
||||
|
||||
"fmt"
|
||||
"io"
|
||||
@@ -113,13 +113,13 @@ func healthToggleHandler(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func getSchemaHandler(w http.ResponseWriter, r *http.Request) {
|
||||
schemaMapJson, _ := json.Marshal(producer.SchemaVersionMap)
|
||||
schemaMapJson, _ := json.Marshal(schema.SchemaVersionMap)
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
w.Write(schemaMapJson)
|
||||
}
|
||||
|
||||
func refreshSchemaHandler(w http.ResponseWriter, r *http.Request) {
|
||||
producer.GetSchemaVersions()
|
||||
schema.GetSchemaVersions()
|
||||
io.WriteString(w, "Updated Schema Map")
|
||||
}
|
||||
|
||||
@@ -130,7 +130,7 @@ func addSchemaHandler(w http.ResponseWriter, r *http.Request) {
|
||||
error := json.Unmarshal(body, &bodyJson)
|
||||
fmt.Println(error)
|
||||
|
||||
errorSchema := producer.AddSchema(bodyJson.Topic, bodyJson.SchemaType, bodyJson.Schema)
|
||||
errorSchema := schema.AddSchema(bodyJson.Topic, bodyJson.SchemaType, bodyJson.Schema)
|
||||
fmt.Println("errorSchema: ")
|
||||
fmt.Println(error)
|
||||
if errorSchema != nil {
|
||||
|
||||
Reference in New Issue
Block a user