package v1 import ( "github.com/gorilla/mux" "net/http" "strconv" ) func RegisterGamesRoutes(r *mux.Router) { r.HandleFunc("/games/{id:[0-9]+}", resolveGame) } func resolveGame(w http.ResponseWriter, r *http.Request) { vars := mux.Vars(r) id, _ := strconv.Atoi(vars["id"]) game, err := FetchGame(int32(id)) Response(w, err, game) }