Add cors stuff
This commit is contained in:
parent
560c974bf3
commit
9363f643f0
10 changed files with 116 additions and 49 deletions
|
|
@ -9,8 +9,9 @@ import gamesRouter from './routes/games.js';
|
|||
const app = express();
|
||||
const PORT = process.env.PORT || 3001;
|
||||
|
||||
const corsOrigins = (process.env.CORS_ORIGIN || 'http://localhost:5173').split(',').map(o => o.trim());
|
||||
app.use(cors({
|
||||
origin: process.env.CORS_ORIGIN || 'http://localhost:5173',
|
||||
origin: corsOrigins.length === 1 ? corsOrigins[0] : corsOrigins,
|
||||
credentials: true,
|
||||
}));
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue