mirror of
https://github.com/Starlio-app/Starlio-web.git
synced 2025-02-25 11:41:25 +03:00
rewritten from net/http to fiber, changed port from 8080, 4662 to one 3000
This commit is contained in:
parent
42f568cf85
commit
16301a3428
8 changed files with 102 additions and 47 deletions
|
@ -2,17 +2,18 @@ package utils
|
|||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"github.com/Redume/EveryNasa/functions"
|
||||
"net/http"
|
||||
"github.com/gofiber/fiber/v2"
|
||||
)
|
||||
|
||||
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)
|
||||
func Respond(c *fiber.Ctx, data map[string]interface{}) {
|
||||
c.Set("Content-Type", "application/json")
|
||||
err := json.NewEncoder(c).Encode(data)
|
||||
if err != nil {
|
||||
functions.Logger(err.Error())
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue