initial commit on github

This commit is contained in:
2021-05-02 16:04:45 +03:00
commit 7babade475
37 changed files with 3271 additions and 0 deletions
+19
View File
@@ -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)
}