initial commit

This commit is contained in:
Данил 2023-05-01 20:49:43 +03:00
parent dd2684c3a9
commit aa8930c07e
No known key found for this signature in database
GPG key ID: 5051BCD5AB064A7B
4 changed files with 209 additions and 0 deletions

20
api/utils/respond.go Normal file
View 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())
}
}