mirror of
https://github.com/Starlio-app/Starlio-web.git
synced 2024-11-22 16:46:22 +03:00
add error handler
This commit is contained in:
parent
01cdf12b54
commit
2e2b079fc4
1 changed files with 4 additions and 1 deletions
|
@ -11,5 +11,8 @@ func Message(status bool, message string) map[string]interface{} {
|
||||||
|
|
||||||
func Respond(w http.ResponseWriter, data map[string]interface{}) {
|
func Respond(w http.ResponseWriter, data map[string]interface{}) {
|
||||||
w.Header().Add("Content-Type", "application/json")
|
w.Header().Add("Content-Type", "application/json")
|
||||||
json.NewEncoder(w).Encode(data)
|
err := json.NewEncoder(w).Encode(data)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue