diff --git a/cmd/serverFunc.go b/cmd/serverFunc.go index fafda14..4e6215d 100644 --- a/cmd/serverFunc.go +++ b/cmd/serverFunc.go @@ -1,10 +1,11 @@ package cmd import ( + "encoding/json" "fmt" - "net/http" - "github.com/gin-gonic/gin" + "log" + "net/http" ) var ( @@ -20,12 +21,12 @@ func server() { func returnWeather(c *gin.Context) { jsonData := getJSON() - c.IndentedJSON(http.StatusOK, jsonData) - //textBytes := []byte(jsonData) - // aemetRequest := root{} - // err := json.Unmarshal(textBytes, &aemetRequest) - // if err != nil { - // log.Fatalf("Error occurred unmarshalling data: %v\n", err) - // } + textBytes := []byte(jsonData) + aemetRequest := root{} + err := json.Unmarshal(textBytes, &aemetRequest) + if err != nil { + log.Fatalf("Error occurred unmarshalling data: %v\n", err) + } + c.IndentedJSON(http.StatusOK, aemetRequest) }