Add get user resp api endpoint
diff --git a/core/kg/api/rest/handler.go b/core/kg/api/rest/handler.go
new file mode 100644
index 0000000..dbc5882
--- /dev/null
+++ b/core/kg/api/rest/handler.go
@@ -0,0 +1,43 @@
+package rest
+
+import (
+	"encoding/json"
+	"net/http"
+)
+
+type HandlerFunc func(w http.ResponseWriter, r *http.Request) error
+
+// ServeHTTP calls f(w, r) and handles error
+func (f HandlerFunc) ServeHTTP(w http.ResponseWriter, r *http.Request) {
+	if err := f(w, r); err != nil {
+		jsoner(w, http.StatusBadRequest, err.Error()) // TODO detect the correct statusCode from error
+	}
+}
+
+func jsoner(w http.ResponseWriter, statusCode int, payload interface{}) error {
+	w.Header().Set("Content-Type", "application/json")
+
+	// If there is nothing to marshal then set status code and return.
+	if payload == nil {
+		_, err := w.Write([]byte("{}"))
+		return err
+	}
+
+	if statusCode != http.StatusOK {
+		w.WriteHeader(statusCode)
+	}
+
+	encoder := json.NewEncoder(w)
+	encoder.SetEscapeHTML(true)
+	encoder.SetIndent("", "")
+
+	if err := encoder.Encode(payload); err != nil {
+		return err
+	}
+
+	if f, ok := w.(http.Flusher); ok {
+		f.Flush()
+	}
+
+	return nil
+}