Skip to content
Snippets Groups Projects
Commit e1eb46ae authored by Felix Schmoll's avatar Felix Schmoll
Browse files

allowed CORS for /dumps

parent 36d508a4
No related branches found
No related tags found
No related merge requests found
...@@ -26,7 +26,7 @@ app.use(bodyParser.urlencoded({ ...@@ -26,7 +26,7 @@ app.use(bodyParser.urlencoded({
// serve only *.xhtml documents // serve only *.xhtml documents
app.use('/docs', function(req, res, next){ app.use('/docs', function(req, res, next){
res.set('Access-Control-Allow-Origin', 'http://localhost:3000'); res.set('Access-Control-Allow-Origin', '*');
if(req.path.endsWith('.xhtml')){ if(req.path.endsWith('.xhtml')){
next(); next();
} else { } else {
...@@ -35,6 +35,7 @@ app.use('/docs', function(req, res, next){ ...@@ -35,6 +35,7 @@ app.use('/docs', function(req, res, next){
}, express.static('docs/')); }, express.static('docs/'));
app.post('/dumps/', function(req, res, next){ app.post('/dumps/', function(req, res, next){
res.set('Access-Control-Allow-Origin', '*');
// read post data from the body // read post data from the body
var post_data = req.body || {}; var post_data = req.body || {};
var id, doc; var id, doc;
...@@ -72,6 +73,7 @@ app.post('/dumps/', function(req, res, next){ ...@@ -72,6 +73,7 @@ app.post('/dumps/', function(req, res, next){
}); });
app.use('/dumps', function(req, res, next){ app.use('/dumps', function(req, res, next){
if(req.path.endsWith('.xhtml')){ if(req.path.endsWith('.xhtml')){
next(); next();
} else { } else {
...@@ -93,7 +95,7 @@ app.get('/get_task', function(req, res){ ...@@ -93,7 +95,7 @@ app.get('/get_task', function(req, res){
// get a mode // get a mode
var mode = ['annotate', 'review'][Math.random() > 0.5 ? 0 : 1] var mode = ['annotate', 'review'][Math.random() > 0.5 ? 0 : 1]
res.set('Access-Control-Allow-Origin', 'http://localhost:3000'); res.set('Access-Control-Allow-Origin', '*');
// TODO: Serve a proper document and result // TODO: Serve a proper document and result
res.jsonp({ res.jsonp({
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment