-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
44 lines (39 loc) · 1.04 KB
/
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
42
43
44
package main
import (
"fmt"
"github.com/azizk17/go-app/config"
)
func main() {
// app := fiber.New()
// app.Get("/", func(c *fiber.Ctx) error {
// return c.SendString("Hello, World 👋!")
// })
// app.Listen(":3000")
c, err := config.LoadConfig(".")
if err != nil {
fmt.Errorf("Could not load configs", err)
}
fmt.Printf("VAR %v\n", c.DB.Host)
if err := c.DB.Setup(); err != nil {
fmt.Errorf("Could not init database", err)
}
// init server
c.Server.Setup()
// run server
if err := c.Server.Serve(); err != nil {
fmt.Errorf("Could not run server", err)
}
// // logger, _ := zap.NewProduction()
// // defer logger.Sync() // flushes buffer, if any
// // sugar := logger.Sugar()
// // sugar.Infow("failed to fetch URL",
// // // Structured context as loosely typed key-value pairs.
// // "url", url,
// // "attempt", 3,
// // "backoff", time.Second,
// // )
// // sugar.Infof("Failed to fetch URL: %s", url)
// // fmt.Printf("VAR %v\n", c)
// // c.Setup()
// // c.Server.ServeWithGraceFullShutdown()s
}