-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
36 lines (29 loc) · 735 Bytes
/
main.go
File metadata and controls
36 lines (29 loc) · 735 Bytes
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
package main
import (
"log"
data "github.com/Voltamon/GoAuthFlow/API/Data"
service "github.com/Voltamon/GoAuthFlow/API/Service"
transport "github.com/Voltamon/GoAuthFlow/API/Transport"
"github.com/gin-gonic/gin"
)
func main() {
db, err := service.InitDB("./API/Data/user.db")
if err != nil {
log.Fatal(err)
}
defer db.Close()
err = service.CreateTables(db)
if err != nil {
log.Fatal(err)
}
userRepo := data.NewUserRepo(db)
serviceSvc := service.NewAuthService(userRepo)
handler := transport.NewHandler(serviceSvc)
router := gin.New()
transport.SetupRoutes(router, handler)
log.Println("Server starting on :8080")
err = router.Run(":8080")
if err != nil {
log.Fatal("Failed to start server:", err)
}
}