From bbcda480ccec73163395a82dd7196a3ef54300a5 Mon Sep 17 00:00:00 2001 From: SDE-ADNAN Date: Fri, 29 Dec 2023 17:29:05 +0530 Subject: [PATCH] Update CORS configuration --- app.ts | 6 +++++- dist/app.js | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/app.ts b/app.ts index d026844..45068e2 100644 --- a/app.ts +++ b/app.ts @@ -21,7 +21,11 @@ dotenv.config({ path: "./ENV/config.env" }) -app.use(cors()); +app.use(cors({ + origin: ['https://adnans-react-typescript-todo.netlify.app'], // Replace with your frontend domain + methods: 'GET,HEAD,PUT,PATCH,POST,DELETE', +})); + app.use(session({ secret: 'your-secret-key', // Change this to your own secret key resave: false, diff --git a/dist/app.js b/dist/app.js index 31264ec..88aca36 100644 --- a/dist/app.js +++ b/dist/app.js @@ -21,7 +21,10 @@ const app = (0, express_1.default)(); dotenv_1.default.config({ path: "./ENV/config.env" }); -app.use((0, cors_1.default)()); +app.use((0, cors_1.default)({ + origin: ['https://adnans-react-typescript-todo.netlify.app'], + methods: 'GET,HEAD,PUT,PATCH,POST,DELETE', +})); app.use((0, express_session_1.default)({ secret: 'your-secret-key', resave: false,