title: Error: connect ETIMEDOUT 127.0.0.1:3000 at TCPConnectWrap.afterConnect [as oncomplete]
body: <p>I am new to nodejs. I run the API call from browser that contains code below and after 10-20 seconds I get the error (below the code).</p>
  <pre class="lang-py prettyprint-override"><code>const request = require(&quot;request&quot;);
  app.get(&quot;/update-user&quot;, (req, res) =&gt; {
  
    if (req.query.id) {
      var separateReqPool = { maxSockets: 20 };
      const url = `https://localhost:3000/api/users?id=${req.query.id}`;
      request({url, separateReqPool}, (error, response, body) =&gt; {
        if (error) console.log(error);
  
        console.log(body);
      });
    }
  });
  
  app.get(&quot;/api/users&quot;, (req, res) =&gt; {
    if (req.query.id) {
      const id = req.query.id;
  
      Order.findById(id)
        .then((data) =&gt; {
            console.log(data);
            res.send(data);
        })
        .catch((err) =&gt; {
          res.status(500).send({ message: &quot;Error retrieving user with id &quot; + id });
        });
    } else {
      Order.find()
        .then((user) =&gt; {
          res.send(user);
        })
        .catch((err) =&gt; {
          res.status(500).send({
            message:
              err.message || &quot;Error Occurred while retriving user information&quot;,
          });
        });
    }
  });
  </code></pre>
  <p>After 10-20 seconds I get the error and nothing gets showed up on the browser.</p>
  <pre><code>Error: connect ETIMEDOUT 127.0.0.1:3000
      at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1146:16) {
    errno: -60,
    code: 'ETIMEDOUT',
    syscall: 'connect',
    address: '127.0.0.1',
    port: 3000
  }
  </code></pre>