美文网首页
NodeJS+Express解决跨域问题:Access-Cont

NodeJS+Express解决跨域问题:Access-Cont

作者: 码码虎呼 | 来源:发表于2019-01-14 11:26 被阅读0次
    app.all('*', function(req, res, next) {
        res.header("Access-Control-Allow-Origin", "*");
        res.header("Access-Control-Allow-Headers", "X-Requested-With");
        res.header("Access-Control-Allow-Methods","PUT,POST,GET,DELETE,OPTIONS");
        res.header("X-Powered-By",' 3.2.1')
        res.header("Content-Type", "application/json;charset=utf-8");
        next();
    });
    

    相关文章

      网友评论

          本文标题:NodeJS+Express解决跨域问题:Access-Cont

          本文链接:https://www.haomeiwen.com/subject/gajddqtx.html