我想使用本机 fetch node.js 18.3 通过代理发出请求,但我不知道如何操作。
我的代码:
import proxyAgent from 'proxy-agent';
(async () => {
const res = await fetch('https://api.ipify.org?format=json', {
agent: new proxyAgent('http://80.48.119.28:8080'),
});
const data = await res.json();
console.log(data); //it shows my ip
})();
Run Code Online (Sandbox Code Playgroud)