title: Stop running task after request timeout in Express.js
body: <p>Let's assume that we have below code, which has timeout set for 5 seconds.</p>
  
  <pre><code>router.get('/timeout', async (req, res, next) =&gt; {
        req.setTimeout(5000, () =&gt; {
          res.status(503)
          res.send()
        })
        while (true) {
          console.log("I'm alive")
        }
        res.status(200)
        res.send({msg: 'success'})
  })
  </code></pre>
  
  <p>I know that the last two lines will never be reached, but that's not a point. The problem which I want to solve is that the while loop is still working despite response was sent. </p>
  
  <p>Is there some way to kill such still working tasks? </p>