mirror of
https://github.com/Starlio-app/Starlio-web.git
synced 2024-11-24 01:26:22 +03:00
19 lines
449 B
Go
19 lines
449 B
Go
package utils
|
|
|
|
import (
|
|
"encoding/json"
|
|
"github.com/Redume/EveryNasa/functions"
|
|
"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")
|
|
err := json.NewEncoder(w).Encode(data)
|
|
if err != nil {
|
|
functions.Logger(err.Error())
|
|
}
|
|
}
|