Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion api/Competition.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ var competitionRoutes = function (app, Competition) {
.sort({status: 'descending', name: 'ascending'})
.exec()
.then(function (docs) {
res.send(docs);
res.header("Access-Control-Allow-Origin", "http://localhost:3000").send(docs);
}, function (error) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can probably add this across the board somehow

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ye very true, add a a piece of middleware like this to app.js before the other routes are defined:

app.get('/*',function(req,res,next){
    res.header("Access-Control-Allow-Origin", "http://localhost:3000");
    next(); 
});

console.log('Ooops: ' + error);
res.status(500).send('Ooops: Unable to retrieve data!');
Expand Down