报错提示如下: XMLHttpRequest cannot load http://www.xxxx.com/264/Data/GetScreenInfo. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access. 今天需要做一个本地测试,html中的js效果涉及跨域拉取数据的问题,Chrome报错并拒绝数…
1,安装 cors 模块 : npm install cors 2,代码 : var express = require('express') var app = express() var cors = require('cors') app.use(cors()) 即可解决跨域问题 .(https://www.npmjs.com/package/cors 官方文档)…