Files
games/features/auth/routes.go
Ryan Hamamura 5120eef776
All checks were successful
CI / Deploy / test (pull_request) Successful in 13s
CI / Deploy / lint (pull_request) Successful in 23s
CI / Deploy / deploy (pull_request) Has been skipped
refactor: streamline routes to RESTful naming conventions
Remove /api/ prefix and consolidate route groups:
- /api/lobby/* -> /games, /snake, /logout (top-level)
- /game/{game_id} + /api/game/{game_id}/* -> /games/{id}/*
- /snake/{game_id} + /api/snake/{game_id}/* -> /snake/{id}/*
- /api/auth/* -> /auth/*
- Standardize snake join page to use return_url= (was return=)
2026-03-02 13:19:03 -10:00

19 lines
529 B
Go

// Package auth handles user authentication routes and handlers.
package auth
import (
"github.com/alexedwards/scs/v2"
"github.com/go-chi/chi/v5"
"github.com/ryanhamamura/c4/db/repository"
)
func SetupRoutes(router chi.Router, queries *repository.Queries, sessions *scs.SessionManager) error {
router.Get("/login", HandleLoginPage())
router.Get("/register", HandleRegisterPage())
router.Post("/auth/login", HandleLogin(queries, sessions))
router.Post("/auth/register", HandleRegister(queries, sessions))
return nil
}