Skip to content

Commit

Permalink
added frontend urls to cors
Browse files Browse the repository at this point in the history
  • Loading branch information
victorchrollo14 committed Jan 22, 2024
1 parent 6569cf4 commit 23d63e3
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ const app = express();
const PORT = process.env.PORT || 3001;

const corsOptions = {
origin: ["http://localhost:3000"],
origin: [
"http://localhost:3000",
"https://mern-ecommerce-frontend-theta.vercel.app",
"https://mern-ecommerce-frontend-git-main-victorchrollo14.vercel.app",
],
credentials: true,
optionSuccessStatus: 200,
};
Expand All @@ -40,7 +44,6 @@ app.use("/cart", cartRouter);

const runServer = async () => {
try {
console.log(process.env.MONGODB_URI);
await mongoose.connect(process.env.MONGODB_URI);
console.log("connected to mongodb");
app.listen(PORT, () => {
Expand Down

0 comments on commit 23d63e3

Please sign in to comment.