init project

This commit is contained in:
m
2026-07-11 20:12:00 +02:00
commit b1f7fe6959
42 changed files with 7930 additions and 0 deletions
+37
View File
@@ -0,0 +1,37 @@
package main
import (
"log"
"os"
"github.com/gin-gonic/gin"
"github.com/vaultdrop/backend/internal/handlers"
)
func main() {
port := os.Getenv("PORT")
if port == "" {
port = "8080"
}
r := gin.Default()
r.GET("/api/v1/health", handlers.Health)
r.GET("/api/v1/files", handlers.ListFiles)
r.POST("/api/v1/files/upload", handlers.UploadFile)
r.GET("/api/v1/files/:id", handlers.GetFile)
r.DELETE("/api/v1/files/:id", handlers.DeleteFile)
r.GET("/api/v1/files/search", handlers.SearchFiles)
r.POST("/api/v1/files/:id/tags", handlers.AddTags)
r.GET("/api/v1/files/:id/tags", handlers.GetTags)
r.POST("/api/v1/ocr/jobs", handlers.CreateOcrJob)
r.GET("/api/v1/ocr/jobs/:id", handlers.GetOcrJobStatus)
log.Printf("Server starting on port %s", port)
if err := r.Run(":" + port); err != nil {
log.Fatal(err)
}
}