跨域请求被阻止:同源策略禁止在https:// 2020 node js读取远程资源

问题描述

基于此问题提出了很多问题,但没有一个解决了我的问题。 我正在使用cloud9 IDE进行开发。我正在尝试使用API​​从节点服务器到角度项目接收数据。我的node.js服务器具有所需的所有CORS标头。但是我继续收到错误。 这是我的服务器代码:

const got = require('got');
const yourArray = [...];

async function run() {
    for (let [index,item] of yourArray.entries()) {
        try {
            let result = await got(item.url);
            // do something with the result
        } catch(e) {
            // either handle the error here or throw to stop further processing
        }
    }
}

run().then(() => {
    console.log("all done");
}).catch(err => {
    console.log(err);
});

这是firefox浏览器上的错误:

enter image description here

是IDE引起问题吗?还是我错过了什么?请帮忙!

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)