title: Stop express function after a reply has already been sent
body: <p>im pretty new into .js and .ts and therefore also to express.js. I have the following lines of code:</p>
  
  <pre><code>    private post = async ( request: express.Request, response: express.Response, next:express.NextFunction) =&gt; 
  {
      await this.myfunction(next) ? console.log("Do nothing") : console.log("end function/request/response");
      await this.anotherfunction();
      }
  </code></pre>
  
  <p>and my function looks like:</p>
  
  <pre><code>private myfunction = async (next: express.NextFunction): Promise&lt;boolean&gt; =&gt; {
  
  let temp: boolean = false;
  
  if(temp){
    return true;
  } else {
    next(
        new HttpException(404, "just an example error")
      );
    return false;
  }
  </code></pre>
  
  <p>HttpException function is build like in here: <a href="https://wanago.io/2018/12/17/typescript-express-error-handling-validation/" rel="nofollow noreferrer">https://wanago.io/2018/12/17/typescript-express-error-handling-validation/</a></p>
  
  <p>My Problem:
  When I trigger my post function, this.myfunction will be executed and "function/request/response" will be printed in the console. After that this.anotherfunction() will be executed. But I want that if I get false as a return from this.myfunction that this.anotherfunction() wont be executed und my incoming request is stopped/cancelled, because I have already sent a response to my enduser in this.myfunction()</p>
  
  <p>How do I do this?</p>