Files
qrank/src/handlers/routes.go
2025-09-18 16:51:57 +02:00

38 lines
890 B
Go

package handlers
import (
"github.com/gin-gonic/gin"
"github.com/ascyii/qrank/src/middleware"
)
func Register(r *gin.Engine) {
// Routes
r.GET("/", getIndex)
r.GET("/login", getLogin)
r.POST("/login", postLogin)
r.GET("/magic", getMagic)
r.GET("/qr/:qrSlug", getQr)
// Authenticated routes
authorized := r.Group("/")
authorized.Use(middleware.RequireAuth())
{
authorized.GET("/logout", getLogout)
authorized.GET("/enter", getEnter)
authorized.POST("/enter", postEnter)
// QR-prepped table routes
authorized.GET("/table/:tableSlug", getTable)
authorized.POST("/table/:tableSlug", postTable)
authorized.POST("/table/:tableSlug/reset", postTableReset)
authorized.GET("/history", getHistory)
authorized.GET("/leaderboard", getLeaderboard)
authorized.GET("/user/:userSlug", getUserView)
authorized.GET("/me", getMe)
authorized.POST("/me", postMe)
}
}