title: nodejs how to avoid blocking requests
body: <p>hi i wrote this simple nodejs server:</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>const express = require('express')
  const app = express()
  
  app.use(express.json())
  
  app.get('/otherget', (req,res) =&gt; {
      res.send('other get');
  });
  app.get('/get', async (req, res) =&gt; {
      let response;
      try{
          response = await func1();
  
      }catch(error){
  
      }
      res.send('response: ' + response);
  });
  
  const func1 = () =&gt; {
      let j = 0;
      for(let i=0; i&lt;10000000000; i++){
          j++;
      }
      return j;
  }
  
  app.listen(4000, () =&gt; console.log('listen 4000'));</code></pre>
  </div>
  </div>
  </p>
  <p>and where the server gets a request to the route '/get' he cant perform any more requests units he has done with that one.</p>
  <p>how can i prevent this situation when my server will have a lot of requests doing a lot of things?</p>