func getSeasonTitles(c web.C, w http.ResponseWriter, r *http.Request) *appError { w.Header().Set("Content-Type", "application/json; charset=utf-8") season, _ := strconv.Atoi(c.URLParams["year"]) seasonTitles := tournaments.Titles([]int{season}) encoder := json.NewEncoder(w) encoder.Encode(seasonTitles) return nil }
func getTotalTitles(c web.C, w http.ResponseWriter, r *http.Request) *appError { w.Header().Set("Content-Type", "application/json; charset=utf-8") tList, err := tournaments.AllTournaments() if err != nil { return &appError{err, "Cant find tournaments", 404} } seasons := tList.Seasons() allTitles := tournaments.Titles(seasons) encoder := json.NewEncoder(w) encoder.Encode(allTitles) return nil }