diff --git a/server.js b/server.js index 4387a27..8ca0a85 100644 --- a/server.js +++ b/server.js @@ -14,7 +14,14 @@ connectDB(); console.log("JWT_SECRET:", process.env.JWT_SECRET); // CORS Configuration -const allowedOrigins = ["http://localhost:3000", "http://127.0.0.1:5500"]; +const allowedOrigins = [ + "http://localhost:3000", + "http://localhost:5500", + "http://localhost:5173", + "http://127.0.0.1:3000", + "http://127.0.0.1:5500", + "http://127.0.0.1:5173", +]; const corsOptions = { origin: function (origin, callback) { if (!origin || allowedOrigins.includes(origin)) { @@ -23,7 +30,7 @@ const corsOptions = { callback(new Error("Not allowed by CORS")); } }, - methods: ["GET", "POST", "PUT","PATCH" , "DELETE", "OPTIONS"], + methods: ["GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"], allowedHeaders: ["Content-Type", "Authorization"], credentials: true, }; @@ -72,8 +79,6 @@ const subscriptionRoutes = require("./src/routes/subscriptionRoutes"); const passwordRoutes = require("./src/routes/passwordRoutes"); const parkingRoutes = require("./src/routes/parkingRoutes"); - - // Define Routes app.use("/auth", authRoutes); @@ -85,8 +90,7 @@ app.use("/api", reportRoutes); app.use("/api", reservationRoutes); app.use("/api", subscriptionRoutes); app.use("/api", passwordRoutes); -app.use('/parkings', parkingRoutes); - +app.use('/parkings', parkingRoutes); // Test Route app.get("/", (req, res) => { diff --git a/yarn.lock b/yarn.lock index c7d6839..8cefb62 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1189,4 +1189,4 @@ webidl-conversions@^7.0.0: xtend@^4.0.0: version "4.0.2" resolved "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz" - integrity sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ== + integrity sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ== \ No newline at end of file