API and Database Deployment Update

This commit is contained in:
2026-02-04 06:53:46 +00:00
parent 1d0ccca7d1
commit e902e5f320
27 changed files with 2156 additions and 395 deletions

View File

@@ -1,32 +1,25 @@
package main
import (
"log"
"time"
"github.com/gin-contrib/cors"
"github.com/gin-gonic/gin"
"clickploy/internal/api"
"clickploy/internal/builder"
"clickploy/internal/db"
"clickploy/internal/deployer"
"clickploy/internal/ports"
)
func main() {
db.Init(".")
pm := ports.NewManager(4000, 5000)
pm := ports.NewManager(2000, 60000)
buildr := builder.NewBuilder()
dply, err := deployer.NewDeployer()
if err != nil {
log.Fatalf("Failed to create deployer: %v", err)
}
handler := api.NewHandler(buildr, dply, pm)
r := gin.Default()
r.Use(cors.New(cors.Config{
AllowOrigins: []string{"*"},
AllowMethods: []string{"GET", "POST", "PUT", "DELETE", "OPTIONS"},
@@ -35,7 +28,6 @@ func main() {
AllowCredentials: true,
MaxAge: 12 * time.Hour,
}))
handler.RegisterRoutes(r)
handler.RegisterAuthRoutes(r)
handler.RegisterUserRoutes(r)
@@ -44,7 +36,6 @@ func main() {
handler.RegisterSystemRoutes(r)
handler.RegisterStorageRoutes(r)
handler.RegisterAdminRoutes(r)
log.Println("Starting Clickploy Backend on :8080")
if err := r.Run(":8080"); err != nil {
log.Fatalf("Server failed: %v", err)