Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

146
Views
Node.js multiple requests

I have a localhost node.js web server that contains 1MB of data

And a client which I'm trying to download the data from using require('http')

after 130 iterations the program breaks:

Error: connect ECONNREFUSED 127.0.0.1:3000

Here is my code:

const timeWrapper = (callback, param) => {
    const start = performance.now();
    callback(param)
    const stop = performance.now();
    console.log('Runtime: ', (stop - start)/1000 + ' seconds');
}


const getData = (from) => {
    for (let i = 0; i < 1000; i++) {
        download(from);
    }
}

// Don't work
timeWrapper(getData, web);

I'd like to know how to fix it

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!