Skip to content

Commit

Permalink
allowed cors
Browse files Browse the repository at this point in the history
  • Loading branch information
Deepak-Sangle committed Nov 23, 2023
1 parent 4a6b297 commit bb4ea46
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
8 changes: 1 addition & 7 deletions server/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,7 @@ const mongoose = require('mongoose');
const cookieParser = require('cookie-parser');
const PORT = process.env.PORT || 5000;

const corsOptions = {
origin: ['http://localhost:3000', 'https://dear-diary-api.onrender.com'],
credentials: true,
methods: ['GET', 'POST']
};

app.use(cors(corsOptions));
app.use(cors());
app.use(cookieParser());

//Set up MongoDB Database
Expand Down
3 changes: 2 additions & 1 deletion server/routes/external.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ require("dotenv").config();
//Getting all requests

router.get('/external/pat-cs360', (req,res)=> {
res.status(200).send({success : true, data : process.env.PAT_FOR_CG});
res.status(200)
.send({success : true, data : process.env.PAT_FOR_CG});
});

module.exports = router;

0 comments on commit bb4ea46

Please sign in to comment.