不多废话直接上码
// 设置统一的响应头
app.all('*', function(req, res, next) {
res.setHeader('Access-Control-Allow-Origin','*');
res.setHeader('Access-Control-Allow-Methods','GET, POST, PUT, DETELE');
res.setHeader('Access-Control-Allow-Headers','X-Requested-With,content-type, Authorization');
// res.setHeader("Content-Type", "application/json;charset=utf-8");
next();
})