This repository has been archived on 2026-05-01. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
PolyNotFound/config/cors.config.js
2021-12-29 19:02:31 +01:00

20 lines
No EOL
514 B
JavaScript

const cors = require('cors');
module.exports.cors = cors;
const whitelist = [
'http://127.0.0.1:4200',
'http://127.0.0.1:4201',
'https://admin-polynotfound.herokuapp.com',
'https://polynotfound.herokuapp.com'
];
module.exports.corsOptions = {
origin: function(origin, callback) {
console.log(whitelist, origin);
if (whitelist.indexOf(origin) !== -1) {
callback(null, true);
} else {
callback(new Error('Not allowed by CORS'));
}
}
}