Node.js 【CORS(cross origin resource sharing) on ExpressJS之笔记】

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

app.get('/', function(req, res, next) {
  // Handle the get for this route
});

app.post('/', function(req, res, next) {
 // Handle the post for this route
});

 

posted @ 2015-04-21 23:16  单先生  阅读(405)  评论(0编辑  收藏  举报