Skip to content

Commit

Permalink
Altered corsOrigin to allow any access.
Browse files Browse the repository at this point in the history
  • Loading branch information
pablisch committed Feb 22, 2024
1 parent 614544e commit fafb9ba
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions api/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ app.use(express.static(path.join(__dirname, "public")));

// Define a middleware function for CORS headers
const handleCors = (req, res, next) => {
res.setHeader('Access-Control-Allow-Origin', corsOrigin);
res.setHeader('Access-Control-Allow-Origin', '*');
res.setHeader('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE, PATCH, OPTIONS');
res.setHeader('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content, Accept, Content-Type, Authorization');
next();
Expand All @@ -36,8 +36,7 @@ app.options('/posts/:id', handleCors, (req, res) => {
});

// Use the CORS middleware for all routes
// app.use(handleCors);
app.use(cors());
app.use(handleCors);


// avatars is the URL path to access the avatars folder
Expand Down

0 comments on commit fafb9ba

Please sign in to comment.