package main import ( "log" "github.com/gin-contrib/cors" "github.com/gin-gonic/gin" "github.com/wisplite/raster/internal/db" "github.com/wisplite/raster/internal/routes" ) func main() { if !db.Init() { log.Fatal("failed to initialize database") } r := gin.Default() // Configure CORS middleware r.Use(cors.New(cors.Config{ AllowOrigins: []string{"http://localhost:3000", "http://localhost:5173"}, AllowMethods: []string{"GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"}, AllowHeaders: []string{"Origin", "Content-Type", "Accept", "Authorization"}, ExposeHeaders: []string{"Content-Length"}, AllowCredentials: true, })) routes.RegisterRoutes(r) r.Run(":8080") }