aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArda Serdar Pektezol <1669855+pektezol@users.noreply.github.com>2023-05-06 17:42:51 +0300
committerArda Serdar Pektezol <1669855+pektezol@users.noreply.github.com>2023-05-06 17:42:51 +0300
commitf229cfaaab4bf55d2a1b25f8a2bad7ad01bdb444 (patch)
tree4b2d47f2154557ebe39eb021b3d50146ac7023cc
parentfeat: get token endpoint (diff)
downloadlphub-f229cfaaab4bf55d2a1b25f8a2bad7ad01bdb444.tar.gz
lphub-f229cfaaab4bf55d2a1b25f8a2bad7ad01bdb444.tar.bz2
lphub-f229cfaaab4bf55d2a1b25f8a2bad7ad01bdb444.zip
fix: enable cors
Diffstat (limited to '')
-rw-r--r--main.go9
1 files changed, 2 insertions, 7 deletions
diff --git a/main.go b/main.go
index ec26280..991f3c0 100644
--- a/main.go
+++ b/main.go
@@ -5,7 +5,6 @@ import (
5 "log" 5 "log"
6 "os" 6 "os"
7 7
8 "github.com/gin-gonic/contrib/cors"
9 "github.com/gin-gonic/gin" 8 "github.com/gin-gonic/gin"
10 "github.com/joho/godotenv" 9 "github.com/joho/godotenv"
11 "github.com/pektezol/leastportals/backend/database" 10 "github.com/pektezol/leastportals/backend/database"
@@ -20,8 +19,8 @@ import (
20// @license.name GNU General Public License, Version 2 19// @license.name GNU General Public License, Version 2
21// @license.url https://www.gnu.org/licenses/old-licenses/gpl-2.0.html 20// @license.url https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
22 21
23// @host lp.ardapektezol.com/api 22// @host lp.ardapektezol.com/api
24// @BasePath /v1 23// @BasePath /v1
25func main() { 24func main() {
26 if os.Getenv("ENV") == "PROD" { 25 if os.Getenv("ENV") == "PROD" {
27 gin.SetMode(gin.ReleaseMode) 26 gin.SetMode(gin.ReleaseMode)
@@ -31,10 +30,6 @@ func main() {
31 log.Fatal("Error loading .env file") 30 log.Fatal("Error loading .env file")
32 } 31 }
33 router := gin.Default() 32 router := gin.Default()
34 config := cors.DefaultConfig()
35 config.AllowAllOrigins = true
36 config.AllowCredentials = true
37 router.Use(cors.New(config))
38 database.ConnectDB() 33 database.ConnectDB()
39 // For frontend static serving - only for local debug 34 // For frontend static serving - only for local debug
40 // router.Use(static.Serve("/", static.LocalFile("./frontend/build", true))) 35 // router.Use(static.Serve("/", static.LocalFile("./frontend/build", true)))