title: How do I shutdown a Node.js http(s) server immediately?
body: <p>I have a Node.js application that contains an http(s) server.</p>
  
  <p>In a specific case, I need to shutdown this server programmatically. What I am currently doing is calling its <code>close()</code> function, but this does not help, as it waits for any kept alive connections to finish first.</p>
  
  <p>So, basically, this shutdowns the server, but only after a minimum wait time of 120 seconds. But I want the server to shutdown immediately - even if this means breaking up with currently handled requests.</p>
  
  <p>What I can not do is a simple</p>
  
  <pre><code>process.exit();
  </code></pre>
  
  <p>as the server is only part of the application, and the rest of the application should remain running. What I am looking for is conceptually something such as <code>server.destroy();</code> or something like that.</p>
  
  <p>How could I achieve this?</p>
  
  <p>PS: The keep-alive timeout for connections is usually required, hence it is not a viable option to decrease this time.</p>