-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
45 lines (36 loc) · 1.31 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
package main
import (
"app/config"
"app/controller"
"app/database"
"app/router"
"app/service"
"app/usecase"
"net/http"
"time"
)
func main() {
time.Local = time.FixedZone("JST", 9*60*60)
db := config.NewDB()
sessionStore := config.NewSessionStore(db)
mailServer := config.NewMail()
sessionService := service.NewSessionService(sessionStore)
cyptoService := service.NewCyptoService()
mailService := service.NewMailService(mailServer)
userRepository := database.NewUserRepository(db)
todoRepository := database.NewTodoRepository(db)
userUsecase := usecase.NewUserUsecase(userRepository)
todoUsecase := usecase.NewTodoUsecase(todoRepository, sessionService)
authUsecase := usecase.NewAuthUsecase(userRepository, sessionService, cyptoService, mailService)
appController := controller.NewAppController()
userController := controller.NewUserController(userUsecase)
authController := controller.NewAuthController(authUsecase)
todoController := controller.NewTodoController(todoUsecase)
appRoute := router.NewAppRouter(appController)
userRoute := router.NewUserRouter(userController)
authRoute := router.NewAuthRouter(authController)
todoRoute := router.NewTodoRouter(todoController)
r := router.NewRouter(appRoute, userRoute, authRoute, todoRoute, sessionStore)
r.SetRouting()
http.ListenAndServe(":3000", nil)
}