-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
65 lines (56 loc) · 1.68 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package main
import (
"github.com/gofiber/fiber/v2"
"github.com/ryuuzake/todolist-gofiber/config"
"github.com/ryuuzake/todolist-gofiber/controller"
"github.com/ryuuzake/todolist-gofiber/domain"
"github.com/ryuuzake/todolist-gofiber/middleware"
"github.com/ryuuzake/todolist-gofiber/repository"
"github.com/ryuuzake/todolist-gofiber/service"
"log"
)
func main() {
app := fiber.New(fiber.Config{
ErrorHandler: middleware.ErrorHandler,
})
userRepository := repository.NewUserRepositoryPostgresImpl()
roleRepository := repository.NewRoleRepositoryPostgresImpl()
todoRepository := repository.NewTodoRepositoryPostgresImpl()
todolistRepository := repository.NewTodolistRepositoryPostgresImpl()
attachmentRepository := repository.NewAttachmentRepositoryPostgresImpl()
fileUploadService := service.FileUploadServiceImpl{}
domain.Admin(app, &controller.AdminControllerImpl{
Service: &service.AdminServiceImpl{
Repository: userRepository,
},
})
domain.Todo(
app,
&controller.TodoControllerImpl{
Service: &service.TodoServiceImpl{
Repository: todoRepository,
},
},
&controller.TodolistControllerImpl{
Service: &service.TodolistServiceImpl{
Repository: todolistRepository,
},
},
&controller.AttachmentControllerImpl{
AttachmentService: &service.AttachmentServiceImpl{
Repository: attachmentRepository,
},
FileUploadService: fileUploadService,
},
)
domain.Auth(app, &controller.AuthControllerImpl{
Service: &service.AuthServiceImpl{
UserRepository: userRepository,
RoleRepository: roleRepository,
},
})
domain.Storage(app, &controller.StorageControllerImpl{
Service: fileUploadService,
})
log.Fatal(app.Listen(config.Config.Address))
}