returnres.status(400).json({error: 'URL parameter is required.'});
}
try{
// Use the built-in fetch in modern Node.js
constresponse=awaitfetch(urlToFetch,{
headers: {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/145.0.0.0 Safari/537.36'}// Set a user-agent
});
if(!response.ok){
// Forward the status and statusText from the target server