Shutting down a Node.js server

You can shut down the Node.JS server by sending a SIGINT signal through a kill command.

About this task

Procedure

  1. Notify all users of the shutdown.
  2. If the server is running on a terminal, press CTRL+C. If the server is running in the background as a process, determine the process ID, and send a SIGINT command to that process. For more information, see kill command Help.
    Note: After the SIGINT signal is received, the Node.js server initiates a shutdown sequence and enters shutdown mode. All of the existing requests are completed and no new requests are entertained. When the last request completes, the server closes all of the connections and shuts down.