package main import ( "api/database" "api/routes" "log" "os" "github.com/gofiber/fiber/v2" "github.com/gofiber/fiber/v2/middleware/cors" ) func main() { if err := database.ConnectDB(); err != nil { panic("Could not connect to database") } app := fiber.New(fiber.Config{ StrictRouting: false, DisableStartupMessage: true, }) app.Use(cors.New(cors.Config{ AllowHeaders: "Origin,Content-Type,Accept,Content-Length,Accept-Language,Accept-Encoding,Connection,Access-Control-Allow-Origin", AllowOrigins: "*", AllowCredentials: true, AllowMethods: "GET,POST,HEAD,PUT,DELETE,PATCH,OPTIONS", })) routes.Setup(app) log.Println("Server started in port " + os.Getenv("API_PORT")) if err := app.Listen(":3800"); err != nil { panic(err) } }