If Creating an API Using NodeJS(如果使用NodeJS创建API)
Your Express app needs to use CORS (Cross-Origin Resource Sharing).
(您的Express应用程序需要使用CORS(跨源资源共享)。)
Add the following to your server file:
(将以下内容添加到您的服务器文件中:)
// This should already be declared in your API file var app = express(); // ADD THIS var cors = require('cors'); app.use(cors());
For fuller understanding of CORS, please read the Mozilla Documentation on CORS .
(为了更全面地了解CORS,请阅读有关CORS的Mozilla文档 。)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…