Skip to content

Commit

Permalink
Enabled CORS
Browse files Browse the repository at this point in the history
  • Loading branch information
nishant-jain-94 committed Mar 8, 2018
1 parent df2dfcd commit 380e701
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ mongoose.connect(config.mongodb.mongodbUrl);

const app = express();

app.use((req, res, next) => {
res.header('Access-Control-Allow-Origin', '*');
res.header('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept');
next();
});

app.use('/ping', (_, res) => {
res.send('pong');
});
Expand Down

0 comments on commit 380e701

Please sign in to comment.