aboutsummaryrefslogtreecommitdiff
path: root/main.go
blob: 21786e8d5fcc127e256158a40a71fdc48493c393 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package main

import (
	"github.com/gin-gonic/contrib/static"
	"github.com/gin-gonic/gin"
	"github.com/pektezol/leastportals/backend/controllers"
	"github.com/pektezol/leastportals/backend/database"
	"github.com/pektezol/leastportals/backend/routes"
)

func main() {
	if controllers.GetEnvKey("ENV") == "PROD" {
		gin.SetMode(gin.ReleaseMode)
	}
	router := gin.Default()
	database.ConnectDB()
	router.Use(static.Serve("/", static.LocalFile("./frontend/dist", true)))
	routes.InitRoutes(router)
	router.Run(":4000")
}