Main project #1
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue