I am writing a little demo web server delivering static html,css and javascript. The server looks like
(function () {
\"use strict\";
var http = req
I hope this will help:
//CORS middleware
var allowCrossDomain = function(req, res, next) {
res.header('Access-Control-Allow-Origin', config.allowedDomains);
res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE');
res.header('Access-Control-Allow-Headers', 'Content-Type');
next();
}
//...
app.configure(function() {
app.use(allowCrossDomain);
app.use(express.static(__dirname + '/public'));
});
More detail: How to allow CORS?