@@ -5,24 +5,30 @@ import cookieParser from "cookie-parser";
55
66const app = express ( ) ;
77
8- app . use ( cors ( {
9- origin : [ "http://localhost:5173" , "http://192.168.1.9:5173" , "https://stremora.vercel.app" , "https://stremora.chinmaypatil.com" ] ,
10- credentials : true ,
8+ // app.use(cors({
9+ // origin: ["http://localhost:5173", "http://192.168.1.9:5173", "https://stremora.vercel.app", "https://stremora.chinmaypatil.com"],
10+ // credentials: true,
11+ // allowedHeaders: ["Content-Type", "Authorization"],
12+ // methods: ["GET", "POST", "PUT", "DELETE", "PATCH"],
13+ // exposedHeaders: ["set-cookie"],
14+ // preflightContinue: true,
15+ // optionsSuccessStatus: 200
16+ // }));
17+
18+ const corsOptions = {
19+ origin : [
20+ "http://localhost:5173" ,
21+ "http://192.168.1.9:5173" ,
22+ "https://stremora.vercel.app" ,
23+ "https://stremora.chinmaypatil.com"
24+ ] ,
25+ methods : [ "GET" , "POST" , "PUT" , "PATCH" , "DELETE" , "OPTIONS" ] ,
1126 allowedHeaders : [ "Content-Type" , "Authorization" ] ,
12- methods : [ "GET" , "POST" , "PUT" , "DELETE" , "PATCH" ] ,
27+ credentials : true ,
1328 exposedHeaders : [ "set-cookie" ] ,
14- preflightContinue : true ,
15- optionsSuccessStatus : 200
16- } ) ) ;
17-
29+ } ;
1830
19- // app.use(
20- // // cors is middleware that decide who can access our server
21- // cors({
22- // origin: process.env.CORS_ORIGIN,
23- // credentials: true
24- // })
25- // )
31+ app . use ( cors ( corsOptions ) ) ;
2632
2733// common middlewares
2834// app.use(express.json({ limit: "16kb" }));
0 commit comments