MCPcopy Create free account
hub / github.com/kataras/iris / getCurrentData

Method getCurrentData

_examples/routing/party-controller/main.go:42–57  ·  view source on GitHub ↗

Normal Iris Handler.

(ctx iris.Context)

Source from the content-addressed store, hash-verified

40
41// Normal Iris Handler.
42func (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}

Callers

nothing calls this directly

Calls 5

URLParamDefaultMethod · 0.80
StatusCodeMethod · 0.65
ErrorMethod · 0.65
GetCurrentByCityMethod · 0.45
JSONMethod · 0.45

Tested by

no test coverage detected