Skip to content
Snippets Groups Projects
Commit 76d56fa3 authored by Baptiste CERDAN's avatar Baptiste CERDAN
Browse files

:adhesive_bandage: add cors

parent 0ff117ba
Branches
1 merge request!8:adhesive_bandage: add cors
# Student Part - ERP 2021
## Baptiste CERDAN, Victor VOGT, Thomas STEINMETZ, Janos FALKE
### Baptiste CERDAN, Victor VOGT, Thomas STEINMETZ, Janos FALKE
## REST endpoints
### REST endpoints
Features the following REST endpoints:
- **/api/signup**
......@@ -17,5 +17,5 @@ Features the following REST endpoints:
- **/api/etudiants** (GET)
## Development
- Run `npm start`, server will run at `http://localhost:8005` and MongoDB `http://localhost:27017`
### Development
- Run `docker-compose up --build`, server will run at `http://localhost:8005` and MongoDB `http://localhost:27017`
......@@ -73,6 +73,9 @@ router.post('/login', async (req, res) => {
router.post('/pay_adhesion', async (req, res) => {
const student_number = req.body.student_number;
res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Headers", "X-Requested-With");
if (!student_number)
return res.status(400);
......@@ -143,6 +146,8 @@ router.post('/me/update', passport.authenticate('jwt', {session: false}), async
router.get('/etudiants', async (req, res) => {
const users = await User.find();
res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Headers", "X-Requested-With");
return res.status(200).json(users);
});
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment