-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
51 lines (38 loc) · 1.5 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package main
import (
"Restobook/configs"
"Restobook/delivery/controllers/auth"
"Restobook/delivery/controllers/ratings"
"Restobook/delivery/controllers/restaurants"
"Restobook/delivery/controllers/topup"
"Restobook/delivery/controllers/transactions"
"Restobook/delivery/controllers/users"
"Restobook/delivery/routes"
ratingRepo "Restobook/repository/ratings"
restaurantRepo "Restobook/repository/restaurants"
topupRepo "Restobook/repository/topup"
transactionRepo "Restobook/repository/transactions"
usersRepo "Restobook/repository/users"
"Restobook/utils"
"fmt"
"github.com/labstack/echo/v4"
)
func main() {
config := configs.GetConfig()
db := utils.InitDB(config)
// xendit.Opt.SecretKey = common.XENDIT_SECRET_KEY
e := echo.New()
usersRepo := usersRepo.NewUsersRepo(db)
usersCtrl := users.NewUsersControllers(usersRepo)
adminCtrl := auth.NewAdminControllers(usersRepo)
restaurantRepo := restaurantRepo.NewRestaurantsRepo(db)
restaurantsCtrl := restaurants.NewRestaurantsControllers(restaurantRepo)
topupRepo := topupRepo.NewTopUpRepo(db)
topupCtrl := topup.NewTopUpControllers(topupRepo)
transactionRepo := transactionRepo.NewTransactionRepo(db)
transactionCtrl := transactions.NewTransactionsControllers(transactionRepo)
ratingRepo := ratingRepo.NewRatingsRepo(db)
ratingCtrl := ratings.NewRatingController(ratingRepo)
routes.RegisterPath(e, adminCtrl, usersCtrl, restaurantsCtrl, transactionCtrl, topupCtrl, ratingCtrl)
e.Logger.Fatal(e.Start(fmt.Sprintf(":%v", config.Port)))
}