-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
32 lines (27 loc) · 791 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 (
"amikom-pedia-api/app"
"amikom-pedia-api/helper"
"amikom-pedia-api/module/user/user_controller"
"amikom-pedia-api/module/user/user_repository"
"amikom-pedia-api/module/user/user_service"
"fmt"
"github.com/go-playground/validator/v10"
_ "github.com/lib/pq"
"net/http"
)
func main() {
db := app.NewDB()
validate := validator.New()
userRepository := user_repository.NewUserRepository()
userService := user_service.NewUserServiceImpl(userRepository, db, validate)
userController := user_controller.NewUserController(userService)
router := app.NewRouter(userController)
server := http.Server{
Addr: "localhost:3000",
Handler: router,
}
err := server.ListenAndServe()
helper.PanicIfError(err)
fmt.Println("Starting web server at port 3000")
}