import express from "express"; import fetch from "node-fetch"; const app = express(); app.get("/api", async (req, res) => { try { const response = await fetch("https://api.example.com/data"); const data = await response.json(); res.json(data); // send back to client } catch (err) { res.status(500).json({ error: "Proxy failed" }); } }); app.listen(3000, () => { console.log("Proxy running on http://localhost:3000"); });