blob: 9bae1763173ae2dee4aa053eeccfac8016c8b4cb (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
package main
import (
"fmt"
"log"
"os"
"github.com/gin-gonic/contrib/static"
"github.com/gin-gonic/gin"
"github.com/joho/godotenv"
"github.com/pektezol/leastportals/backend/database"
"github.com/pektezol/leastportals/backend/routes"
)
func main() {
if os.Getenv("ENV") == "PROD" {
gin.SetMode(gin.ReleaseMode)
}
err := godotenv.Load()
if err != nil {
log.Fatal("Error loading .env file")
}
router := gin.Default()
database.ConnectDB()
router.Use(static.Serve("/", static.LocalFile("./frontend/dist", true)))
routes.InitRoutes(router)
router.Run(fmt.Sprintf(":%s", os.Getenv("PORT")))
}
|