diff --git a/view/html.go b/view/html.go index 2864488..71e1fc5 100644 --- a/view/html.go +++ b/view/html.go @@ -21,6 +21,7 @@ func Html(g storage.Graph) error { func foo(g storage.Graph) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Access-Control-Allow-Origin", "*") var err error switch path.Base(r.URL.Path) { case "who": @@ -65,8 +66,9 @@ func who(g storage.Graph, w http.ResponseWriter, r *http.Request) error { for j := range one.Connections { if one.Connections[j].Name == another.Name { one.Connections[j] = entity.One{ - Name: another.Name, Relationship: one.Connections[j].Relationship, + Type: another.Type, + Modified: another.Modified, } } } @@ -75,5 +77,7 @@ func who(g storage.Graph, w http.ResponseWriter, r *http.Request) error { results[id] = one } log.Println("results:", results) - return json.NewEncoder(w).Encode(results) + enc := json.NewEncoder(w) + enc.SetIndent("", " ") + return enc.Encode(results) }