nodejs 项目解决浏览器跨域问题。

//设置跨域访问json

app.all('*', function(req, res, next) {跨域

    res.header("Access-Control-Allow-Origin", "*");app

    res.header("Access-Control-Allow-Headers", "X-Requested-With");utf-8

    res.header("Access-Control-Allow-Methods","PUT,POST,GET,DELETE,OPTIONS");it

    res.header("X-Powered-By",' 3.2.1')io

    res.header("Content-Type", "application/json;charset=utf-8");function

    next();next

});header

相关文章
相关标签/搜索