-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
41 lines (31 loc) · 784 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
33
34
35
36
37
38
39
40
41
package main
import (
"log"
"now-go-kon/pkg"
"now-go-kon/pkg/infrastructure"
"now-go-kon/pkg/util"
"github.com/gin-gonic/gin"
ginSwagger "github.com/swaggo/gin-swagger"
swaggerfiles "github.com/swaggo/files"
_ "github.com/swaggo/swag/example/celler/docs"
)
func main() {
config, err := util.LoadConfig(".")
if err != nil {
log.Fatal("cannot load config", err)
}
setupRDB(config)
r := gin.Default()
pkg.RegisterHandlers(r, config)
r.GET("/healthCheck", pkg.HealthCheckHandler)
r.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerfiles.Handler))
pkg.RegisterNotFoundHandler(r)
if err := r.Run(":8080"); err != nil {
log.Fatal(err)
}
}
func setupRDB(config util.Config) {
if err := infrastructure.RDBConnect(config); err != nil {
log.Fatal(err)
}
}