diff options
| author | Arda Serdar Pektezol <1669855+pektezol@users.noreply.github.com> | 2024-10-19 18:11:01 +0300 |
|---|---|---|
| committer | Arda Serdar Pektezol <1669855+pektezol@users.noreply.github.com> | 2024-10-19 18:11:01 +0300 |
| commit | fc238b4f66f3bba701fd2caec9bec3ff8cb67529 (patch) | |
| tree | 0464d98f0b03f70871e2e8a5ba6990a2ea2cbaab /backend/main.go | |
| parent | backend: fix run ranks (diff) | |
| download | lphub-fc238b4f66f3bba701fd2caec9bec3ff8cb67529.tar.gz lphub-fc238b4f66f3bba701fd2caec9bec3ff8cb67529.tar.bz2 lphub-fc238b4f66f3bba701fd2caec9bec3ff8cb67529.zip | |
stop pushing local changes idiot
Diffstat (limited to 'backend/main.go')
| -rw-r--r-- | backend/main.go | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/backend/main.go b/backend/main.go index 6499b51..e7a0ede 100644 --- a/backend/main.go +++ b/backend/main.go | |||
| @@ -4,13 +4,11 @@ import ( | |||
| 4 | "fmt" | 4 | "fmt" |
| 5 | "log" | 5 | "log" |
| 6 | "os" | 6 | "os" |
| 7 | "time" | ||
| 8 | 7 | ||
| 9 | "lphub/api" | 8 | "lphub/api" |
| 10 | "lphub/database" | 9 | "lphub/database" |
| 11 | _ "lphub/docs" | 10 | _ "lphub/docs" |
| 12 | 11 | ||
| 13 | "github.com/gin-contrib/cors" | ||
| 14 | "github.com/gin-gonic/gin" | 12 | "github.com/gin-gonic/gin" |
| 15 | "github.com/joho/godotenv" | 13 | "github.com/joho/godotenv" |
| 16 | ) | 14 | ) |
| @@ -36,19 +34,19 @@ func main() { | |||
| 36 | database.ConnectDB() | 34 | database.ConnectDB() |
| 37 | api.InitRoutes(router) | 35 | api.InitRoutes(router) |
| 38 | // for debugging | 36 | // for debugging |
| 39 | router.Use(cors.New(cors.Config{ | 37 | // router.Use(cors.New(cors.Config{ |
| 40 | AllowOrigins: []string{"*"}, | 38 | // AllowOrigins: []string{"*"}, |
| 41 | AllowMethods: []string{"GET", "POST", "DELETE", "PUT", "PATCH"}, | 39 | // AllowMethods: []string{"GET", "POST", "DELETE", "PUT", "PATCH"}, |
| 42 | AllowHeaders: []string{"Origin"}, | 40 | // AllowHeaders: []string{"Origin"}, |
| 43 | ExposeHeaders: []string{"Content-Length"}, | 41 | // ExposeHeaders: []string{"Content-Length"}, |
| 44 | AllowCredentials: true, | 42 | // AllowCredentials: true, |
| 45 | MaxAge: 12 * time.Hour, | 43 | // MaxAge: 12 * time.Hour, |
| 46 | })) | 44 | // })) |
| 47 | router.Static("/static", "../frontend/build/static") | 45 | // router.Static("/static", "../frontend/build/static") |
| 48 | router.StaticFile("/", "../frontend/build/index.html") | 46 | // router.StaticFile("/", "../frontend/build/index.html") |
| 49 | router.NoRoute(func(c *gin.Context) { | 47 | // router.NoRoute(func(c *gin.Context) { |
| 50 | c.File("../frontend/build/index.html") | 48 | // c.File("../frontend/build/index.html") |
| 51 | }) | 49 | // }) |
| 52 | router.MaxMultipartMemory = 200 << 20 // 200 mb limit for demos | 50 | router.MaxMultipartMemory = 200 << 20 // 200 mb limit for demos |
| 53 | router.Run(fmt.Sprintf(":%s", os.Getenv("PORT"))) | 51 | router.Run(fmt.Sprintf(":%s", os.Getenv("PORT"))) |
| 54 | } | 52 | } |