Normal Iris Handler.
(ctx iris.Context)
| 40 | |
| 41 | // Normal Iris Handler. |
| 42 | func (api *WeatherController) getCurrentData(ctx iris.Context) { |
| 43 | city := ctx.URLParamDefault("city", "Athens") |
| 44 | |
| 45 | // Call the controller's "Client"'s GetCurrentByCity method |
| 46 | // to retrieve data from external provider and push them to our clients. |
| 47 | data, err := api.Client.GetCurrentByCity(ctx, city) |
| 48 | if err != nil { |
| 49 | ctx.StatusCode(iris.StatusBadRequest) |
| 50 | ctx.JSON(iris.Map{ |
| 51 | "error": err.Error(), |
| 52 | }) |
| 53 | return |
| 54 | } |
| 55 | |
| 56 | ctx.JSON(data) |
| 57 | } |
nothing calls this directly
no test coverage detected