diff options
| author | Arda Serdar Pektezol <1669855+pektezol@users.noreply.github.com> | 2024-09-10 22:13:24 +0300 |
|---|---|---|
| committer | Arda Serdar Pektezol <1669855+pektezol@users.noreply.github.com> | 2024-09-10 22:13:24 +0300 |
| commit | 16165aea34a711027825b3f6512e73a0156f8068 (patch) | |
| tree | 138d92b8b01c41e07a3a2316fd109ddd97e80fa6 /main.go | |
| parent | refactor: update readme (diff) | |
| download | lphub-16165aea34a711027825b3f6512e73a0156f8068.tar.gz lphub-16165aea34a711027825b3f6512e73a0156f8068.tar.bz2 lphub-16165aea34a711027825b3f6512e73a0156f8068.zip | |
refactor: move backend entry, rename module
Diffstat (limited to 'main.go')
| -rw-r--r-- | main.go | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/main.go b/main.go deleted file mode 100644 index ad465f8..0000000 --- a/main.go +++ /dev/null | |||
| @@ -1,36 +0,0 @@ | |||
| 1 | package main | ||
| 2 | |||
| 3 | import ( | ||
| 4 | "fmt" | ||
| 5 | "log" | ||
| 6 | "os" | ||
| 7 | |||
| 8 | "github.com/gin-gonic/gin" | ||
| 9 | "github.com/joho/godotenv" | ||
| 10 | "github.com/pektezol/leastportalshub/backend/api" | ||
| 11 | "github.com/pektezol/leastportalshub/backend/database" | ||
| 12 | _ "github.com/pektezol/leastportalshub/docs" | ||
| 13 | ) | ||
| 14 | |||
| 15 | // @title Least Portals Database API | ||
| 16 | // @version 1.0 | ||
| 17 | // @description Backend API endpoints for the Least Portals Database. | ||
| 18 | |||
| 19 | // @license.name GNU General Public License, Version 2 | ||
| 20 | // @license.url https://www.gnu.org/licenses/old-licenses/gpl-2.0.html | ||
| 21 | |||
| 22 | // @host lp.ardapektezol.com | ||
| 23 | // @BasePath /api/v1 | ||
| 24 | func main() { | ||
| 25 | err := godotenv.Load() | ||
| 26 | if err != nil { | ||
| 27 | log.Fatal("Error loading .env file") | ||
| 28 | } | ||
| 29 | if os.Getenv("ENV") == "PROD" { | ||
| 30 | gin.SetMode(gin.ReleaseMode) | ||
| 31 | } | ||
| 32 | router := gin.Default() | ||
| 33 | database.ConnectDB() | ||
| 34 | api.InitRoutes(router) | ||
| 35 | router.Run(fmt.Sprintf(":%s", os.Getenv("PORT"))) | ||
| 36 | } | ||