Skip to content

Commit

Permalink
rituLink
Browse files Browse the repository at this point in the history
  • Loading branch information
imdeveshshukla committed Aug 24, 2024
1 parent afa8c92 commit 3cc7487
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion backend/src/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,21 @@ dotenv.config({
})
const app = express()
const port = 3000
const dep = (origin, callback) => {
const allowedOrigins = [
'https://www.bequiet.live',
'https://www.bequiet.vercel.app'
];

if (allowedOrigins.includes(origin) || !origin) {
callback(null, true);
} else {
callback(new Error('Not allowed by CORS'));
}
};
const corsOptions = {
credentials: true,
origin: (process.env.NODE_ENV === 'development')?'http://localhost:5173':'https://www.bequiet.live',
origin: (process.env.NODE_ENV === 'development')?'http://localhost:5173':dep,
methods: ["GET", "POST", "PUT", "DELETE", "OPTIONS"],
allowedHeaders: [
"Origin",
Expand Down

0 comments on commit 3cc7487

Please sign in to comment.