Files
games/features/lobby/routes.go
Ryan Hamamura 587f392b8b fix: serve datastar locally and clean up session/route config
Replace CDN-hosted datastar beta.11 with local v1.0.0-RC.7 to fix
client-side expression incompatibilities with the Go SDK. Also fix
quoted CSS class keys in data-class expressions, harden session cookie
settings (named cookie, Secure flag), simplify SetupRoutes to not
return an error, and regenerate templ output.
2026-03-02 14:34:39 -10:00

27 lines
746 B
Go

// Package lobby handles the game lobby page, game creation, and navigation.
package lobby
import (
"github.com/ryanhamamura/c4/db/repository"
"github.com/ryanhamamura/c4/game"
"github.com/ryanhamamura/c4/snake"
"github.com/alexedwards/scs/v2"
"github.com/go-chi/chi/v5"
)
func SetupRoutes(
router chi.Router,
queries *repository.Queries,
sessions *scs.SessionManager,
store *game.GameStore,
snakeStore *snake.SnakeStore,
) {
router.Get("/", HandleLobbyPage(queries, sessions, snakeStore))
router.Post("/games", HandleCreateGame(store, sessions))
router.Delete("/games/{id}", HandleDeleteGame(store, sessions))
router.Post("/snake", HandleCreateSnakeGame(snakeStore, sessions))
router.Post("/logout", HandleLogout(sessions))
}