-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
41 lines (32 loc) · 875 Bytes
/
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
package main
import (
"health-app/app/config"
middlewares "health-app/app/middlewares"
service_users "health-app/business/users"
handler_users "health-app/controllers/users"
migrate "health-app/migrator"
mysql_users "health-app/repository/users/mysql"
routes "health-app/routes"
"github.com/labstack/echo/v4"
)
func main() {
db := config.InitDB()
migrate.AutoMigrate(db)
configJWT := middlewares.ConfigJwt{
SecretJWT: config.Conf.JWTSecret,
}
e := echo.New()
//Factory
// Users
userRepo := mysql_users.NewUsersRepo(db)
userServ := service_users.NewUsersBusiness(userRepo, &configJWT)
UserHandler := handler_users.NewUsersHandler(userServ)
// Route
routeInit := routes.ControllerList{
JWTMiddleware: configJWT.Init(),
UserHandler: UserHandler,
}
routeInit.RouteRegister(e)
// start server
e.Logger.Fatal(e.Start(":8080"))
}