FILE / Unmei/Backend
routes/games.go
Исходный файл и его история в репозитории.
18 lines
315 B
Go
18 lines
315 B
Go
package routes
|
|
|
|
import (
|
|
"backend/database"
|
|
"github.com/go-chi/chi/v5"
|
|
"net/http"
|
|
)
|
|
|
|
func RegisterGamesRoutes(r chi.Router) {
|
|
r.Get("/{id:[0-9]+}", getGame)
|
|
}
|
|
|
|
func getGame(w http.ResponseWriter, r *http.Request) {
|
|
id := IURLParam(r, "id")
|
|
game, err := database.FetchGame(int32(id))
|
|
Response(w, err, game)
|
|
}
|