21 lines
600 B
Go
21 lines
600 B
Go
package router
|
|
|
|
import (
|
|
"bamort/registry"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
// BaseRouterGrp registers all base (unauthenticated) routes from every module
|
|
// and returns the protected /api router group secured with the registered auth
|
|
// middleware. Modules self-register via their init() functions; no direct
|
|
// module imports are required here.
|
|
func BaseRouterGrp(r *gin.Engine) *gin.RouterGroup {
|
|
// Call all base-route registrars (login, register, password-reset, …)
|
|
registry.RunAllBaseRoutes(r)
|
|
|
|
protected := r.Group("/api")
|
|
protected.Use(registry.GetAuthMiddleware())
|
|
return protected
|
|
}
|