-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
57 lines (49 loc) · 1.39 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
45
46
47
48
49
50
51
52
53
54
55
56
57
package main
import (
"issue-reporting/api"
"issue-reporting/auth"
"issue-reporting/cron"
"issue-reporting/database"
"issue-reporting/incidents"
"issue-reporting/reports"
"issue-reporting/schedules"
"issue-reporting/users"
"log"
"os"
_ "issue-reporting/docs"
"github.com/gofiber/fiber/v2"
"github.com/gofiber/fiber/v2/middleware/cors"
"github.com/gofiber/fiber/v2/middleware/logger"
"github.com/gofiber/fiber/v2/middleware/recover"
"github.com/joho/godotenv"
)
func main() {
godotenv.Load()
if err := database.Connect(); err != nil {
log.Fatal(err)
}
cron.StartNotifyAssignScheduler()
// cron.ReportGeneratorScheduler()
// cron.StartNotifyAcknowlegedScheduler()
port := os.Getenv("PORT")
app := fiber.New()
app.Use(recover.New())
app.Use(cors.New(cors.Config{
AllowOrigins: "https://roaring-biscotti-b91532.netlify.app, http://localhost:3000, http://localhost:3001",
AllowHeaders: "*",
AllowMethods: "*",
AllowCredentials: true,
}))
app.Use(logger.New(logger.Config{
Format: "${cyan}[${time}] ${red}[${ip}] ${magenta}${bytesSent}bytes ${green}${latency} ${blue}${method} ${blue}${status} ${white}${path}\n",
TimeFormat: "02-Jan-2006",
TimeZone: "UTC",
}))
auth.RegisterAuthRoutes(app)
incidents.RegisterRoutes(app)
users.RegisterRoutes(app)
schedules.RegisterRoutes(app)
reports.RegisterRoutes(app)
api.RegisterRoutes(app)
app.Listen(":" + port)
}