Skip to content

Commit

Permalink
updated header options
Browse files Browse the repository at this point in the history
  • Loading branch information
jazicorn committed Oct 5, 2023
1 parent df3fb8a commit f251757
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion apps/api/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,18 @@ class App {
this.app.use(cors({
origin: this.corsOptions
}));
this.app.use(function(req, res, next) {
this.app.use( (req, res, next) => {
res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept, Authorization");
res.header('Access-Control-Allow-Methods', 'PUT, POST, GET, DELETE, OPTIONS');
next();
});
this.app.options("/", (req, res) => {
res.setHeader("Access-Control-Allow-Origin", "*");
res.setHeader("Access-Control-Allow-Methods", "PUT, POST, GET, DELETE, OPTIONS");
res.setHeader("Access-Control-Allow-Headers", "Content-Type");
res.sendStatus(204);
});
// this.app.set('trust proxy', 1) // trust first proxy
// this.app.use(session({
// secret: process.env.SECRET_TOKEN,
Expand Down

1 comment on commit f251757

@vercel
Copy link

@vercel vercel bot commented on f251757 Oct 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

recodecamp-api – ./apps/api

recodecamp-api.vercel.app
recodecamp-api-git-main-jazicorn.vercel.app
recodecamp-api-jazicorn.vercel.app

Please sign in to comment.