func players(ctx *web.Context) []byte { ctx.SetHeader("Content-Type", "application/json", true) players, err := arena.GetPlayers() checkError(err) jsonPlayers, err := json.Marshal(players) checkError(err) return jsonPlayers }
func PlayersHandler(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json") players, err := arena.GetPlayers() checkError(err) fmt.Fprint(w, Response{"players": players}) }