import fetch from "node-fetch";
import { HttpsProxyAgent } from "https-proxy-agent";
const proxyUrl = "http://proxy-server:8080";
const agent = new HttpsProxyAgent(proxyUrl);
const targetUrl = "https://api.example.com/resource";
fetch(targetUrl, {
method: "GET",
agent,
headers: {
"Authorization": "Bearer token",
"Content-Type": "application/json",
},
})
import fetch from "node-fetch";
import { HttpsProxyAgent } from "https-proxy-agent";
const proxyUrl = "http://proxy-server:8080";
const agent = new HttpsProxyAgent(proxyUrl);
const targetUrl = "https://api.example.com/resource";
fetch(targetUrl, {
method: "GET",
agent,
headers: {
"Authorization": "Bearer token",
"Content-Type": "application/json",
},
})