Skip to content

Commit

Permalink
Update CORS configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
SDE-ADNAN committed Dec 29, 2023
1 parent 192f0a5 commit bbcda48
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
6 changes: 5 additions & 1 deletion app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
5 changes: 4 additions & 1 deletion dist/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit bbcda48

Please sign in to comment.