mirror of
https://github.com/Starlio-app/StarlioX
synced 2025-02-22 23:13:12 +03:00
add other functions
This commit is contained in:
parent
41a46c7c6c
commit
1370774f6d
3 changed files with 163 additions and 0 deletions
15
api/utils/utils.go
Normal file
15
api/utils/utils.go
Normal 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)
|
||||
}
|
Loading…
Add table
Reference in a new issue