Skip to content

Commit 684b362

Browse files
committed
feat:url changed
1 parent 20da01e commit 684b362

6 files changed

Lines changed: 85 additions & 11 deletions

File tree

auth-service/src/presentation/server.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,21 @@ if(process.env.NODE_ENV === "development"){
2121
app.use(morgan("dev"))
2222
}
2323

24+
// app.use(cors({
25+
// origin: 'https://v-learning-client-5r8j.vercel.app',
26+
// credentials: true,
27+
// allowedHeaders: ['Range', 'Authorization', 'Content-Type','Accept'],
28+
// exposedHeaders: ['Content-Disposition','Content-Range', 'Accept-Ranges', 'Content-Length', 'Content-Type'],
29+
// methods: ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS']
30+
// }));
31+
32+
2433
app.use(cors({
2534
origin: 'https://v-learning-client-5r8j.vercel.app',
35+
methods: ["GET", "POST", "HEAD", "PUT", "PATCH", "DELETE", "OPTIONS"],
2636
credentials: true,
27-
allowedHeaders: ['Range', 'Authorization', 'Content-Type','Accept'],
28-
exposedHeaders: ['Content-Disposition','Content-Range', 'Accept-Ranges', 'Content-Length', 'Content-Type'],
29-
methods: ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS']
37+
allowedHeaders: ['Content-Type', 'Authorization', 'Cookie', 'Range', 'Accept'],
38+
exposedHeaders: ['Content-Disposition', 'Content-Range', 'Accept-Ranges', 'Content-Length', 'Content-Type']
3039
}));
3140

3241
app.use('/',routes(dependencies));

chat-service/src/presentation/server.ts

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,23 @@ app.use(express.urlencoded({extended:true}))
2020
app.use(cookieParser());
2121

2222
const allowedOrigins = process.env.CLIENT_URL;
23-
const corsOptions = {
24-
origin: allowedOrigins,
25-
methods: ["GET,HEAD,PUT,POST,DELETE,OPTIONS"],
26-
credentials : true
27-
}
2823

29-
app.use(cors(corsOptions));
24+
// const corsOptions = {
25+
// origin: allowedOrigins,
26+
// methods: ["GET,HEAD,PUT,POST,DELETE,OPTIONS"],
27+
// credentials : true
28+
// }
29+
30+
// app.use(cors(corsOptions));
31+
32+
app.use(cors({
33+
origin:allowedOrigins,
34+
credentials: true,
35+
allowedHeaders: ['Authorization', 'Content-Type', 'Range', 'Accept'],
36+
exposedHeaders: ['Content-Disposition', 'Content-Range', 'Accept-Ranges', 'Content-Length', 'Content-Type'],
37+
methods: ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS']
38+
}));
39+
3040

3141
const server = createServer(app);
3242

course-srv/src/presentation/server.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,26 @@ app.use(express.json())
2020
app.use(express.urlencoded({extended:true}));
2121
app.use(cookieParser());
2222
// app.use(bodyParser.text({type: '/'}));
23+
24+
25+
// app.use(cors({
26+
// origin: 'https://v-learning-client-5r8j.vercel.app',
27+
// credentials: true,
28+
// allowedHeaders: ['Range', 'Authorization', 'Content-Type','Accept'],
29+
// exposedHeaders: ['Content-Disposition','Content-Range', 'Accept-Ranges', 'Content-Length', 'Content-Type'],
30+
// methods: ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS']
31+
// }));
32+
33+
2334
app.use(cors({
2435
origin: 'https://v-learning-client-5r8j.vercel.app',
2536
credentials: true,
26-
allowedHeaders: ['Range', 'Authorization', 'Content-Type','Accept'],
27-
exposedHeaders: ['Content-Disposition','Content-Range', 'Accept-Ranges', 'Content-Length', 'Content-Type'],
37+
allowedHeaders: ['Authorization', 'Content-Type', 'Range', 'Accept'],
38+
exposedHeaders: ['Content-Disposition', 'Content-Range', 'Accept-Ranges', 'Content-Length', 'Content-Type'],
2839
methods: ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS']
2940
}));
3041

42+
3143
// Add helmet with CORP configuration
3244
app.use(helmet({
3345
crossOriginResourcePolicy: { policy: "cross-origin" }

notification-service/package-lock.json

Lines changed: 31 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

notification-service/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,15 @@
1313
"license": "ISC",
1414
"dependencies": {
1515
"cookie-parser": "^1.4.7",
16+
"cors": "^2.8.5",
1617
"dotenv": "^16.4.5",
1718
"express": "^4.21.1",
1819
"kafkajs": "^2.2.4",
1920
"nodemailer": "^6.9.16"
2021
},
2122
"devDependencies": {
2223
"@types/cookie-parser": "^1.4.7",
24+
"@types/cors": "^2.8.17",
2325
"@types/dotenv": "^8.2.3",
2426
"@types/express": "^5.0.0",
2527
"@types/node": "^22.9.0",

notification-service/src/presentation/server.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import dotenv from "dotenv";
33
import cookieParser from "cookie-parser";
44
import { notificationRoutes } from '../infrastructure/routes';
55
import { dependencies } from '../__boot/dependencies';
6+
import cors from 'cors'
67

78
dotenv.config();
89

@@ -13,6 +14,15 @@ app.use(express.json());
1314
app.use(express.urlencoded({extended:true}));
1415
app.use(cookieParser());
1516

17+
app.use(cors({
18+
origin: 'https://v-learning-client-5r8j.vercel.app',
19+
credentials: true,
20+
allowedHeaders: ['Authorization', 'Content-Type', 'Range', 'Accept'],
21+
exposedHeaders: ['Content-Disposition', 'Content-Range', 'Accept-Ranges', 'Content-Length', 'Content-Type'],
22+
methods: ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS']
23+
}));
24+
25+
1626
app.get("/",(req:Request, res:Response) => {
1727
res.status(200).json({
1828
message:"Notification service is ON!!!!!"

0 commit comments

Comments
 (0)