init bootstrap
This commit is contained in:
37
local/api/api.go
Normal file
37
local/api/api.go
Normal file
@@ -0,0 +1,37 @@
|
||||
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)
|
||||
}
|
||||
Reference in New Issue
Block a user