()
| 51 | } |
| 52 | |
| 53 | func main() { |
| 54 | app := fiber.New() |
| 55 | app.Use(cors.New(cors.Config{ |
| 56 | AllowOrigins: os.Getenv("CORS_SITES"), |
| 57 | })) |
| 58 | app.Use(recover.New()) |
| 59 | app.Use(requestid.New()) |
| 60 | app.Use(logger.New(logger.Config{Format: "[${time}] ${locals:requestid} ${status} - ${method} ${path}\n"})) |
| 61 | app.Use(compress.New(compress.Config{ |
| 62 | Level: compress.LevelBestSpeed, |
| 63 | })) |
| 64 | initDabatase() |
| 65 | storeEmails() |
| 66 | |
| 67 | validate.Config(func(opt *validate.GlobalOption) { |
| 68 | opt.StopOnError = false |
| 69 | }) |
| 70 | |
| 71 | endpoints.SetupPublicRoutes(app) |
| 72 | |
| 73 | // JWT Middleware |
| 74 | app.Use(jwtware.New(jwtware.Config{ |
| 75 | SigningKey: []byte(os.Getenv("JWT_SECRET")), |
| 76 | })) |
| 77 | |
| 78 | endpoints.SetupPrivateRoutes(app) |
| 79 | |
| 80 | s := gocron.NewScheduler(time.UTC) |
| 81 | s.Every(1).Day().At("00:01").Do(runScheduledNotifications) |
| 82 | s.StartAsync() |
| 83 | |
| 84 | log.Fatal(app.Listen(os.Getenv("PORT"))) |
| 85 | } |
nothing calls this directly
no test coverage detected