initial commit on github
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user