在app.js的设置中添加
//设置允许跨域访问该服务. app.all('*', function (req, res, next) { res.header('Access-Control-Allow-Origin', '*'); res.header('Access-Control-Allow-Headers', 'Content-Type'); res.header('Access-Control-Allow-Methods', '*'); res.header('Content-Type', 'application/json;charset=utf-8'); next(); });
标签:Control,跨域,Allow,res,express,Access,header,设置 From: https://www.cnblogs.com/MingYX/p/17303211.html