Main project #1

Merged
raul merged 33 commits from testing into main 2024-06-14 07:49:34 +02:00
1 changed files with 7 additions and 2 deletions
Showing only changes of commit 212462be3d - Show all commits

View File

@ -20,10 +20,15 @@ func server() {
}
func returnWeather(c *gin.Context) {
jsonData := getJSON()
jsonData, err := getJSON()
if err != nil {
e := fmt.Sprint(err)
c.String(http.StatusInternalServerError, e)
return
}
textBytes := []byte(jsonData)
aemetRequest := root{}
err := json.Unmarshal(textBytes, &aemetRequest)
err = json.Unmarshal(textBytes, &aemetRequest)
if err != nil {
log.Fatalf("Error occurred unmarshalling data: %v\n", err)
}