Added cleanup logic.

This commit is contained in:
2025-08-07 22:25:02 +02:00
parent afccf236fc
commit 716c6730b5
9 changed files with 115 additions and 16 deletions

11
main.go
View File

@@ -1,7 +1,8 @@
package main
import (
"fitra-backend/endpoints"
"fitra-backend/application"
"fitra-backend/controllers"
"fmt"
"os"
@@ -9,12 +10,14 @@ import (
)
func main() {
go application.StartCleanupRoutine()
r := gin.Default()
r.LoadHTMLGlob("views/*")
r.GET("/", endpoints.HandleIndex)
r.POST("/upload", endpoints.HandleFileUpload)
r.GET("/uploads/:fileID/:filename", endpoints.HandleFileDownload)
r.GET("/", controllers.HandleIndex)
r.POST("/upload", controllers.HandleFileUpload)
r.GET("/uploads/:fileID/:filename", controllers.HandleFileDownload)
r.GET("/health", func(c *gin.Context) { c.JSON(200, gin.H{"status": "ok"}) })
if port := os.Getenv("PORT"); port != "" {