← All examples
02 / Node.js
Price monitoring with Node.js
Schedule bounded fetches and reuse a sticky session when several steps belong together.
You will build
A measurable monitor job with one exit per run
E-commerceSticky
Node.js
import { ProxyAgent } from "undici";
const key = process.env.PROXYAPI_KEY;
if (!key) throw new Error("PROXYAPI_KEY is required");
const runId = Date.now().toString(36);
const dispatcher = new ProxyAgent(
`https://${key}-country-se-type-isp-session-price${runId}:@proxy.proxyapi.se:443`,
);
const response = await fetch("https://example.com/product", {
dispatcher,
signal: AbortSignal.timeout(20_000),
headers: { "user-agent": "YourCompanyPriceMonitor/1.0" },
});
if (!response.ok) throw new Error(`Target returned ${response.status}`);
const html = await response.text();
console.log({ bytes: html.length, status: response.status }); Before production
- ✓Identify your client where appropriate and keep frequency proportionate.
- ✓Start with datacenter exits; change type only when measurements show it is needed.