Skip to content

Commit

Permalink
Merge pull request #36 from lucasmontano/task/adding-cors
Browse files Browse the repository at this point in the history
Adding CORS to GET top participants endpoint
  • Loading branch information
lucasmontano authored May 6, 2020
2 parents d6aa857 + 1bfa4ab commit de6a540
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
12 changes: 10 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
},
"dependencies": {
"axios": "^0.19.2",
"cors": "^2.8.5",
"dotenv": "^8.2.0",
"express": "^4.17.1",
"mongodb": "^3.5.7"
Expand Down
3 changes: 2 additions & 1 deletion src/app.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import express from 'express';
import cors from 'cors';
import DatabaseClient from './database';

import ChatterService from './services/ChatterService';
Expand Down Expand Up @@ -48,7 +49,7 @@ setInterval(async () => {
}
}, 60 * 1000);

app.get('/', async (req, res) => {
app.get('/', cors(), async (req, res) => {
const participantsCollection = client.getCollection<Participant>(
'participants',
);
Expand Down

0 comments on commit de6a540

Please sign in to comment.