host是如果是本机那就是127.0.0.1,至于端口取决你的代理设置
注意,添加上

const axios = require("axios");
const HttpsProxyAgent = require("https-proxy-agent");

// 
const httpsAgent = new HttpsProxyAgent(`http://${YOUR_HOST}:${YOUR_PORT}`);
const axios = Axios.create({
    proxy:false,
    httpsAgent
})

httpsAgent的时候,需要设置 proxy 为 false,这一点很重要

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐