Initial sanitized code sync
This commit is contained in:
42
internal/handler/router.go
Normal file
42
internal/handler/router.go
Normal file
@@ -0,0 +1,42 @@
|
||||
package handler
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func SetupRouter(devMode bool) *gin.Engine {
|
||||
r := gin.Default()
|
||||
|
||||
// Public routes
|
||||
pub := r.Group("/api")
|
||||
pub.POST("/login", LoginRateLimitMiddleware(), Login)
|
||||
pub.POST("/logout", Logout)
|
||||
|
||||
// Protected routes
|
||||
api := r.Group("/api")
|
||||
api.Use(AuthMiddleware())
|
||||
{
|
||||
api.GET("/auth/check", CheckAuth)
|
||||
|
||||
// Config
|
||||
api.GET("/config", GetConfig)
|
||||
api.PUT("/config", UpdateConfig)
|
||||
|
||||
// Dashboard
|
||||
api.GET("/dashboard", GetDashboard)
|
||||
|
||||
// Cards + Card Codes
|
||||
RegisterCardRoutes(api)
|
||||
|
||||
// Email Records
|
||||
RegisterEmailRecordRoutes(api)
|
||||
|
||||
// Tasks
|
||||
RegisterTaskRoutes(api)
|
||||
|
||||
// Accounts
|
||||
RegisterAccountRoutes(api)
|
||||
}
|
||||
|
||||
return r
|
||||
}
|
||||
Reference in New Issue
Block a user