aboutsummaryrefslogtreecommitdiff
path: root/backend/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'backend/main.go')
-rw-r--r--backend/main.go37
1 files changed, 37 insertions, 0 deletions
diff --git a/backend/main.go b/backend/main.go
new file mode 100644
index 0000000..202c607
--- /dev/null
+++ b/backend/main.go
@@ -0,0 +1,37 @@
1package main
2
3import (
4 "fmt"
5 "log"
6 "os"
7
8 "lphub/api"
9 "lphub/database"
10 _ "lphub/docs"
11
12 "github.com/gin-gonic/gin"
13 "github.com/joho/godotenv"
14)
15
16// @title Least Portals Database API
17// @version 1.0
18// @description Backend API endpoints for the Least Portals Database.
19
20// @license.name GNU Affero General Public License, Version 3
21// @license.url https://www.gnu.org/licenses/agpl-3.0.html
22
23// @host lp.ardapektezol.com
24// @BasePath /api/v1
25func main() {
26 err := godotenv.Load()
27 if err != nil {
28 log.Fatal("Error loading .env file")
29 }
30 if os.Getenv("ENV") == "PROD" {
31 gin.SetMode(gin.ReleaseMode)
32 }
33 router := gin.Default()
34 database.ConnectDB()
35 api.InitRoutes(router)
36 router.Run(fmt.Sprintf(":%s", os.Getenv("PORT")))
37}