const http = require('http');
const options = {
hostname: 'example.com',
timeout: 5000 // Extend timeout to 5000 ms
};
const req = http.get(options, (res) => {
// Handle response
}).on('timeout', () => {
req.abort();
console.error('Request timed out');
});