MCPcopy Create free account
hub / github.com/devinterface/startersaas-go-api / main

Function main

main.go:53–85  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

51}
52
53func 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}

Callers

nothing calls this directly

Calls 4

SetupPublicRoutesFunction · 0.92
SetupPrivateRoutesFunction · 0.92
initDabataseFunction · 0.85
storeEmailsFunction · 0.85

Tested by

no test coverage detected