CORS

http://en.wikipedia.org/wiki/Cross-origin_resource_sharing

For dev test only.

var allowCrossDomain = function(req, res, next) {
res.header('Access-Control-Allow-Origin', 'http://localhost');
res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE');
res.header('Access-Control-Allow-Headers', 'Content-Type');

next();
}

app.configure(function(){
app.use(express.bodyParser());
app.use(allowCrossDomain);
});

 

posted on 2014-01-27 09:20  grep  阅读(191)  评论(0编辑  收藏  举报