aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorArda Serdar Pektezol <1669855+pektezol@users.noreply.github.com>2023-04-20 22:40:33 +0300
committerArda Serdar Pektezol <1669855+pektezol@users.noreply.github.com>2023-04-21 23:57:48 +0300
commit54c68dfe2f070a849e3ac87f096d588068e8a6ae (patch)
treef9e58ff914e2dd1647ea56162068d6db62bd760e /main.go
parentdoc: add auth header fields (#34) (diff)
downloadlphub-54c68dfe2f070a849e3ac87f096d588068e8a6ae.tar.gz
lphub-54c68dfe2f070a849e3ac87f096d588068e8a6ae.tar.bz2
lphub-54c68dfe2f070a849e3ac87f096d588068e8a6ae.zip
fix: frontend serving
Diffstat (limited to '')
-rw-r--r--main.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/main.go b/main.go
index 2fcf453..aae2a18 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/static"
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)
@@ -32,7 +31,8 @@ func main() {
32 } 31 }
33 router := gin.Default() 32 router := gin.Default()
34 database.ConnectDB() 33 database.ConnectDB()
35 router.Use(static.Serve("/", static.LocalFile("./frontend/dist", true))) 34 // For frontend static serving - only for local debug
35 // router.Use(static.Serve("/", static.LocalFile("./frontend/dist", true)))
36 routes.InitRoutes(router) 36 routes.InitRoutes(router)
37 router.Run(fmt.Sprintf(":%s", os.Getenv("PORT"))) 37 router.Run(fmt.Sprintf(":%s", os.Getenv("PORT")))
38} 38}