Cleaned code

This commit is contained in:
2025-08-07 22:13:39 +02:00
parent 6bcedf84f6
commit afccf236fc
5 changed files with 23 additions and 56 deletions

17
main.go
View File

@@ -15,16 +15,13 @@ func main() {
r.GET("/", endpoints.HandleIndex)
r.POST("/upload", endpoints.HandleFileUpload)
r.GET("/uploads/:fileID/:filename", endpoints.HandleFileDownload)
r.GET("/health", func(c *gin.Context) {
c.JSON(200, gin.H{"status": "ok"})
})
r.GET("/health", func(c *gin.Context) { c.JSON(200, gin.H{"status": "ok"}) })
port := os.Getenv("PORT")
if port == "" {
port = "8080"
if port := os.Getenv("PORT"); port != "" {
fmt.Printf("FITRA Backend starting on port %s\n", port)
r.Run(":" + port)
} else {
fmt.Println("FITRA Backend starting on port 8080")
r.Run(":8080")
}
fmt.Printf("FITRA Backend starting on port %s\n", port)
r.Run(":" + port)
}