Full refactor of codebase
This commit is contained in:
37
src/handlers/routes.go
Normal file
37
src/handlers/routes.go
Normal file
@@ -0,0 +1,37 @@
|
||||
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)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user