Skip to content

Commit

Permalink
allow cors from all origin
Browse files Browse the repository at this point in the history
  • Loading branch information
jazzgrewal committed Oct 5, 2023
1 parent db35093 commit a0e0b6c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions backend/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const express = require('express');
const cors = require('cors');
const dotenv =require('dotenv');
const indexRoutes = require("./routes/indexRoutes");
const mailRoutes = require("./routes/mailRoutes");
Expand All @@ -8,7 +9,11 @@ dotenv.config({
path: './.env'
})
const app = express();

// Configure CORS options
const corsOptions = {origin: '*'};
app.use(express.json());
app.use(cors(corsOptions));

app.use('/api/', indexRoutes);
app.use('/api/mail', mailRoutes);
Expand Down

0 comments on commit a0e0b6c

Please sign in to comment.