mirror of
https://github.com/Starlio-app/StarlioX
synced 2025-02-22 23:13:12 +03:00
initial commit
This commit is contained in:
parent
dd2684c3a9
commit
aa8930c07e
4 changed files with 209 additions and 0 deletions
20
api/utils/respond.go
Normal file
20
api/utils/respond.go
Normal file
|
@ -0,0 +1,20 @@
|
|||
package utils
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"github.com/Redume/EveryNASA/utils"
|
||||
|
||||
"github.com/gofiber/fiber/v2"
|
||||
)
|
||||
|
||||
func Message(status bool, message string) map[string]interface{} {
|
||||
return map[string]interface{}{"status": status, "message": message}
|
||||
}
|
||||
|
||||
func Respond(c *fiber.Ctx, data map[string]interface{}) {
|
||||
c.Set("Content-Type", "application/json")
|
||||
err := json.NewEncoder(c).Encode(data)
|
||||
if err != nil {
|
||||
utils.Log(err.Error())
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue