Skip to content

Commit

Permalink
updated cors
Browse files Browse the repository at this point in the history
  • Loading branch information
zion-off committed May 29, 2024
1 parent ecf6798 commit ab81abd
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions back-end/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ try {
`Error connecting to MongoDB user account authentication will fail: ${err}`
);
}
// app.use(function(req, res, next) {
// res.header("Access-Control-Allow-Origin", "http://localhost:3000/");
// res.header("Access-Control-Allow-Credentials", "true");
// res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
// next();
// });
app.use(function(req, res, next) {
res.header("Access-Control-Allow-Origin", `process.env.FRONT_END_DOMAIN`);
res.header("Access-Control-Allow-Credentials", "true");
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
next();
});
app.use(morgan("dev", { skip: (req, res) => process.env.NODE_ENV === "test" }))
app.use(express.json())
app.use(express.urlencoded({ extended: true }))
Expand Down

0 comments on commit ab81abd

Please sign in to comment.