-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
31 lines (26 loc) · 790 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
package main
import (
"bubblevy/restful-api/app"
"bubblevy/restful-api/controller"
"bubblevy/restful-api/helper"
"bubblevy/restful-api/middleware"
"bubblevy/restful-api/repository"
"bubblevy/restful-api/service"
"net/http"
"github.com/go-playground/validator/v10"
_ "github.com/go-sql-driver/mysql"
)
func main() {
db := app.NewDB()
validate := validator.New()
productRepository := repository.NewProductRepository()
productService := service.NewProductService(productRepository, db, validate)
productController := controller.NewProductController(productService)
router := app.NewRouter(productController)
server := http.Server{
Addr: "localhost:3000",
Handler: middleware.NewAuthMiddleware(router),
}
err := server.ListenAndServe()
helper.PanicIfError(err)
}