-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
36 lines (28 loc) · 792 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
package main
import (
"datahandler_go/helpers"
"datahandler_go/jobs"
"datahandler_go/routes"
"fmt"
"log"
"github.com/gofiber/fiber/v2"
"github.com/gofiber/fiber/v2/middleware/logger"
"github.com/gofiber/fiber/v2/middleware/recover"
"github.com/gofiber/fiber/v2/middleware/requestid"
)
func main() {
port := helpers.EnvVariable("PORT")
app := fiber.New()
// Use middlewares
app.Use(requestid.New())
app.Use(logger.New(logger.Config{
Format: "${time} | ${status} | ${latency} | ${ip} | ${method} | ${path} | ${ua} | ${locals:requestid} | ${bytesSent}B\n",
TimeFormat: "15:04:05",
TimeZone: "Local",
}))
app.Use(recover.New())
routes.SetupRoutes(app)
go jobs.RunJobs()
fmt.Printf("Server listening on port %s\n", port)
log.Fatal(app.Listen(":" + port))
}