28 lines
782 B
Go
28 lines
782 B
Go
package routes
|
|
|
|
import (
|
|
"starter/backend/internal/handlers"
|
|
"starter/backend/internal/middleware"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
// RegisterRoutes registers all API routes under the given group
|
|
func RegisterRoutes(rg *gin.RouterGroup) {
|
|
// Apply CORS middleware first (before any other middleware)
|
|
rg.Use(middleware.CORS())
|
|
|
|
// Then apply other middlewares
|
|
rg.Use(middleware.Logger())
|
|
|
|
// Define routes
|
|
rg.GET("/health", middleware.AuthRequired(), handlers.HealthCheck)
|
|
|
|
// Logto authentication routes
|
|
rg.GET("/auth/", handlers.HomeHandler)
|
|
rg.GET("/auth/sign-in", handlers.SignInHandler)
|
|
rg.GET("/auth/callback", handlers.CallbackHandler)
|
|
rg.GET("/auth/sign-out", handlers.SignOutHandler)
|
|
rg.GET("/auth/user-id-token-claims", handlers.UserIdTokenClaimsHandler)
|
|
}
|