-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
33 lines (25 loc) · 664 Bytes
/
main.go
File metadata and controls
33 lines (25 loc) · 664 Bytes
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
package main
import (
"final-project/config"
"final-project/controller"
"final-project/repository"
"final-project/routers"
"final-project/services"
"github.com/gin-gonic/gin"
_ "github.com/go-sql-driver/mysql"
"github.com/spf13/viper"
)
func main() {
config.LoadConfig("config")
db, err := config.Connect()
if err != nil {
panic(err)
}
r := gin.Default()
port := ":" + viper.GetString("server.port")
userRepo := repository.NewUserRepository(db)
userService := services.NewCarServices(userRepo)
userController := controller.NewUserController(db, userService)
router := routers.NewRouter(r, *userController, port)
router.StartServer()
}