-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
32 lines (26 loc) · 872 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
package main
import (
"github.com/gin-gonic/gin"
configuration "todo-app/appconfig"
"todo-app/internal/todo-app/application/controller"
"todo-app/internal/todo-app/application/handler"
"todo-app/internal/todo-app/application/repository"
"todo-app/pkg/couchbase"
"todo-app/pkg/server"
)
func main() {
engine := gin.New()
//couchbase
couchbaseCluster := couchbase.ConnectCluster(
configuration.CouchbaseHost,
configuration.CouchbaseUsername,
configuration.CouchbasePassword,
)
todoRepository := repository.NewTodoRepository(couchbaseCluster)
todoCommandHandler := handler.NewTodoCommandHandler(todoRepository)
todoController := controller.NewTodoController(todoCommandHandler)
todoGroup := engine.Group("api/v1/todo")
todoGroup.GET("", todoController.GetAll)
todoGroup.POST("", todoController.Save)
server.NewServer(engine).StartHttpServer()
}