- dbAdapter.DeleteAppInstanceInfo(db, appInstanceId)
- common.RespondJSON(w, http.StatusOK, json.NewEncoder(w).Encode(""))
+ impl.dbAdapter.DeleteAppInstanceInfo(appInstanceId)
+ respondJSON(w, http.StatusOK, json.NewEncoder(w).Encode(""))
+}
+
+// It makes the JSON
+func respondJSON(w http.ResponseWriter, status int, payload interface{}) {
+ response, err := json.Marshal(payload)
+ if err != nil {
+ w.WriteHeader(http.StatusInternalServerError)
+ w.Write([]byte(err.Error()))
+ return
+ }
+ w.Header().Set("Content-Type", "application/json")
+ w.WriteHeader(status)
+ w.Write([]byte(response))
+}
+
+// RespondError makes the error response with payload as json format
+func respondError(w http.ResponseWriter, code int, message string) {
+ respondJSON(w, code, map[string]string{"error": message})