Files
games/features/lobby/routes.go
Ryan Hamamura afd8a3e9d0
Some checks failed
CI / Deploy / test (pull_request) Successful in 8s
CI / Deploy / lint (pull_request) Failing after 44s
CI / Deploy / deploy (pull_request) Has been skipped
fix: resolve all linting errors and add SSE compression
- Add brotli compression (level 5) to long-lived SSE event streams
  (HandleGameEvents, HandleSnakeEvents) to reduce wire payload
- Fix all errcheck violations with nolint annotations for best-effort calls
- Fix goimports: separate stdlib, third-party, and local import groups
- Fix staticcheck: add package comments, use tagged switch
- Zero lint issues remaining
2026-03-02 12:38:21 -10:00

31 lines
814 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,
) error {
router.Get("/", HandleLobbyPage(queries, sessions, snakeStore))
router.Route("/api/lobby", func(r chi.Router) {
r.Post("/create-game", HandleCreateGame(store, sessions))
r.Delete("/game/{id}", HandleDeleteGame(store, sessions))
r.Post("/create-snake", HandleCreateSnakeGame(snakeStore, sessions))
r.Post("/logout", HandleLogout(sessions))
})
return nil
}