add simple fetch to another service

This commit is contained in:
2025-10-30 14:44:26 +01:00
parent e0929aff56
commit 802dfc97a2
2 changed files with 37 additions and 4 deletions
+10 -2
View File
@@ -33,8 +33,16 @@ func (h *Handler) GetMeteoData(w http.ResponseWriter, r *http.Request) {
if err := params.Validate(); err != nil {
slog.Error("error validating struct", "error", err)
h.ToJSON(w, http.StatusBadRequest, app.H{"error": err.Error()})
return
}
slog.Info("loc value", "value", params)
return
data, err := h.s.GetWeatherByCity(r.Context(), params)
if err != nil {
slog.Error("error", "err", err)
h.ToJSON(w, http.StatusInternalServerError, app.H{"error": err})
return
}
slog.Info("data retrieved", "location", params.Location)
h.ToJSON(w, http.StatusOK, data)
}