Skip to content

Commit

Permalink
added logs to fix cors issues
Browse files Browse the repository at this point in the history
  • Loading branch information
caitoor committed May 6, 2024
1 parent 7986cc4 commit 21ee8fd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
9 changes: 4 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ services:
- "3000:3000"
networks:
- proxy
- starbugs
- starbugs_network

mongo:
image: mongo:7
Expand All @@ -70,13 +70,12 @@ services:
order: start-first
networks:
- proxy
- starbugs
- starbugs_network

networks:
proxy:
external: true
starbugs:
starbugs_network:


volumes:
mongo_data:
mongo_data:
5 changes: 4 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,11 @@ mongoose.connect(mongoUri)
.then(() => console.log('MongoDB connection successful'))
.catch(err => console.error('MongoDB connection error:', err));

const frontendUrl = `https://${process.env.FRONTEND_SUBDOMAIN}.${process.env.DOMAIN}/`;
console.log(`frontendUrl: ${frontendUrl}`);

const corsOptions = {
origin: `https://${process.env.FRONTEND_SUBDOMAIN}.${process.env.DOMAIN}/`,
origin: frontendUrl,
};

app.use(cors(corsOptions));
Expand Down

0 comments on commit 21ee8fd

Please sign in to comment.