Files
omega-server/local/api/api.go
Fran Jurmanović 016728532c init bootstrap
2025-07-06 15:02:09 +02:00

38 lines
755 B
Go

package api
import (
"omega-server/local/controller"
"omega-server/local/utl/common"
"omega-server/local/utl/configs"
"omega-server/local/utl/logging"
"github.com/gofiber/fiber/v2"
"go.uber.org/dig"
)
// Routes
// Initializes web api controllers and its corresponding routes.
//
// Args:
// *fiber.App: Fiber Application
func Init(di *dig.Container, app *fiber.App) {
// Protected routes
groups := app.Group(configs.Prefix)
routeGroups := &common.RouteGroups{
API: groups.Group("/api"),
Auth: groups.Group("/auth"),
Users: groups.Group("/membership"),
}
err := di.Provide(func() *common.RouteGroups {
return routeGroups
})
if err != nil {
logging.Panic("unable to bind routes")
}
controller.InitializeControllers(di)
}