diff --git a/docker-compose.yml b/docker-compose.yml index e5726fe..4f5bc33 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,7 +7,7 @@ services: environment: MONGODB_URI: PORT: "5000" - ENV: development + ENV: production ports: - "5000:5000" diff --git a/server/main.go b/server/main.go index 3f178df..40d4db4 100644 --- a/server/main.go +++ b/server/main.go @@ -7,7 +7,7 @@ import ( "os" "github.com/gofiber/fiber/v2" - "github.com/joho/godotenv" + "github.com/gofiber/fiber/v2/middleware/cors" "go.mongodb.org/mongo-driver/bson" "go.mongodb.org/mongo-driver/bson/primitive" "go.mongodb.org/mongo-driver/mongo" @@ -27,10 +27,10 @@ func main() { if os.Getenv("ENV") != "production" { // Load the .env file if not in production - err := godotenv.Load(".env") - if err != nil { - log.Fatal("Error loading .env file:", err) - } + // err := godotenv.Load(".env") + // if err != nil { + // log.Fatal("Error loading .env file:", err) + // } } MONGODB_URI := os.Getenv("MONGODB_URI") @@ -54,10 +54,10 @@ func main() { app := fiber.New() - // app.Use(cors.New(cors.Config{ - // AllowOrigins: "http://localhost:5173", - // AllowHeaders: "Origin,Content-Type,Accept", - // })) + app.Use(cors.New(cors.Config{ + AllowOrigins: "http://localhost:5173", + AllowHeaders: "Origin,Content-Type,Accept", + })) app.Get("/api/todos", getTodos) app.Post("/api/todos", createTodo)