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=)
19 lines
529 B
Go
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
|
|
}
|