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