Commit 71d4a53e authored by AravindR-K's avatar AravindR-K

updated

parent 1fdd41b6
...@@ -14,11 +14,18 @@ const app = express(); ...@@ -14,11 +14,18 @@ const app = express();
// Middleware // Middleware
app.use(cors({ app.use(cors({
origin: [ origin: function (origin, callback) {
'http://localhost:4200', const allowed = [
'https://quiz-master-oxo7-4r2hvqr2w-aravind05rk.vercel.app', 'http://localhost:4200',
process.env.FRONTEND_URL process.env.FRONTEND_URL
].filter(Boolean), ];
// Allow any origin that ends with 'vercel.app' or is directly allowed
if (!origin || allowed.includes(origin) || origin.endsWith('vercel.app')) {
callback(null, true);
} else {
callback(null, false);
}
},
credentials: true credentials: true
})); }));
app.use(express.json()); app.use(express.json());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment