aboutsummaryrefslogtreecommitdiff
path: root/backend/main.go
diff options
context:
space:
mode:
authorArda Serdar Pektezol <1669855+pektezol@users.noreply.github.com>2025-10-27 22:12:31 +0300
committerArda Serdar Pektezol <1669855+pektezol@users.noreply.github.com>2025-10-27 23:13:45 +0400
commit96f55dba15bcbba4e6d8f14035ecfd20ebcea8a8 (patch)
treed33156305b0e34e1c28e294e021447635dde3531 /backend/main.go
parentfix/frontend: hide breakpoint in-between tablet and desktop on maps (#290) (diff)
downloadlphub-96f55dba15bcbba4e6d8f14035ecfd20ebcea8a8.tar.gz
lphub-96f55dba15bcbba4e6d8f14035ecfd20ebcea8a8.tar.bz2
lphub-96f55dba15bcbba4e6d8f14035ecfd20ebcea8a8.zip
feat/backend: timeline stats endpoint
Diffstat (limited to '')
-rw-r--r--backend/main.go36
1 files changed, 13 insertions, 23 deletions
diff --git a/backend/main.go b/backend/main.go
index e422359..2147be8 100644
--- a/backend/main.go
+++ b/backend/main.go
@@ -29,35 +29,25 @@ func main() {
29 if err != nil { 29 if err != nil {
30 log.Fatal("Error loading .env file") 30 log.Fatal("Error loading .env file")
31 } 31 }
32 var app *newrelic.Application
32 if os.Getenv("ENV") == "PROD" { 33 if os.Getenv("ENV") == "PROD" {
33 gin.SetMode(gin.ReleaseMode) 34 gin.SetMode(gin.ReleaseMode)
34 } 35 app, err = newrelic.NewApplication(
35 app, err := newrelic.NewApplication( 36 newrelic.ConfigAppName("lphub"),
36 newrelic.ConfigAppName("lphub"), 37 newrelic.ConfigLicense(os.Getenv("NEWRELIC_LICENSE_KEY")),
37 newrelic.ConfigLicense(os.Getenv("NEWRELIC_LICENSE_KEY")), 38 newrelic.ConfigAppLogForwardingEnabled(true),
38 newrelic.ConfigAppLogForwardingEnabled(true), 39 )
39 ) 40 if err != nil {
40 if err != nil { 41 log.Fatal("Error instrumenting newrelic")
41 log.Fatal("Error instrumenting newrelic") 42 }
42 } 43 }
43 router := gin.Default() 44 router := gin.Default()
44 router.Use(nrgin.Middleware(app)) 45 if app != nil {
46 router.Use(nrgin.Middleware(app))
47 }
48 // router.Use(cors.Default()) // ONLY FOR DEV
45 database.ConnectDB() 49 database.ConnectDB()
46 api.InitRoutes(router) 50 api.InitRoutes(router)
47 // for debugging
48 // router.Use(cors.New(cors.Config{
49 // AllowOrigins: []string{"*"},
50 // AllowMethods: []string{"GET", "POST", "DELETE", "PUT", "PATCH"},
51 // AllowHeaders: []string{"Origin"},
52 // ExposeHeaders: []string{"Content-Length"},
53 // AllowCredentials: true,
54 // MaxAge: 12 * time.Hour,
55 // }))
56 // router.Static("/static", "../frontend/build/static")
57 // router.StaticFile("/", "../frontend/build/index.html")
58 // router.NoRoute(func(c *gin.Context) {
59 // c.File("../frontend/build/index.html")
60 // })
61 router.MaxMultipartMemory = 250 << 20 // 250 mb limit for demos 51 router.MaxMultipartMemory = 250 << 20 // 250 mb limit for demos
62 router.Run(fmt.Sprintf(":%s", os.Getenv("PORT"))) 52 router.Run(fmt.Sprintf(":%s", os.Getenv("PORT")))
63} 53}