29 lines
500 B
Go
29 lines
500 B
Go
package main
|
|
|
|
import (
|
|
"fitra-backend/endpoints"
|
|
"fmt"
|
|
"os"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
func main() {
|
|
r := gin.Default()
|
|
|
|
r.POST("/upload", endpoints.HandleFileUpload)
|
|
r.GET("/download/:filename", endpoints.HandleFileDownload)
|
|
r.GET("/files", endpoints.ListFiles)
|
|
r.GET("/health", func(c *gin.Context) {
|
|
c.JSON(200, gin.H{"status": "ok"})
|
|
})
|
|
|
|
port := os.Getenv("PORT")
|
|
if port == "" {
|
|
port = "8080"
|
|
}
|
|
|
|
fmt.Printf("FITRA Backend starting on port %s\n", port)
|
|
r.Run(":" + port)
|
|
}
|