This commit is contained in:
2019-08-30 15:50:59 +02:00
parent a01e519bc2
commit f70caf557c
8 changed files with 184 additions and 0 deletions
+15
View File
@@ -0,0 +1,15 @@
package utils
import (
"encoding/json"
"net/http"
)
func Message(status bool, message string) (map[string]interface{}) {
return map[string]interface{} {"status" : status, "message" : message}
}
func Respond(w http.ResponseWriter, data map[string] interface{}) {
w.Header().Add("Content-Type", "application/json")
json.NewEncoder(w).Encode(data)
}