We have options to use exit or terminate from a Node.js application in different ways,

Option 1:

If you are running a Node.js program in the console window, can close that application using "CTRL+C". We will discuss in the post how do we do it in programmatically existing.

Option 2:

process - This module can provide and handy method that allows you to programmatic ally exist from application. Use with an object exit,


Ends the process with the specified code and different exit code have different meaning. By default the exit code is 0 that means success. To exit with a 'failure' code: