Init commit
This commit is contained in:
28
main.go
Normal file
28
main.go
Normal file
@@ -0,0 +1,28 @@
|
||||
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)
|
||||
}
|
||||
Reference in New Issue
Block a user