title: In Express.js why does code after res.json() still execute?
body: <p>In Node with Express, I have a piece of code like this. </p>
  
  <pre><code> if (req.body.var1 &gt;= req.body.var2){
          res.json({success: false, message: "End time must be AFTER start time"});
          console.log('Hi')
   }
   console.log('Hi2')
   //other codes
  </code></pre>
  
  <p>I expected that if var1 is >= var2, the response would be sent and the execution would end. Like return statements in Java/C#</p>
  
  <p>But appearantly that's not the case. After the response is sent, both 'Hi' and 'Hi2' and all the other code after that continues to get executed.</p>
  
  <p>I was wondering how I would stop this from happening? </p>
  
  <p>Also, I was wondering under what circumstances would you actually want code to keep on executing after a response has already been sent.</p>
  
  <p>Cheers</p>