Skip to content
the poor coder

node js quit

Poor Man
Published
Reading time
1 min read
On this page

Node JS Quit#

Have you ever been in a situation where your Node JS application is running and you want to stop it? There are two ways you can quit a Node JS application.

Method 1: Using CTRL + C#

The simplest way to quit a Node JS application is by using CTRL + C. When you press CTRL + C, the Node JS process will be terminated, and the terminal will be free again.

Method 2: Using process.exit()#

If for some reason, you cannot use CTRL + C to quit your Node JS application, you can use the process.exit() method. This method will terminate the Node JS process and exit the application.

Text

    process.exit();
  

The process.exit() method can also take an exit code as an argument. The exit code is a number that represents the status of the application. A successful exit will have an exit code of 0, while an unsuccessful exit will have a non-zero exit code.

Text

    process.exit(1);
  

It is important to note that using process.exit() is not recommended in most cases. It is better to let the Node JS process exit naturally.

Keep going

2023

how to sort an array

How to Sort an Array If you have an array and you want to order its elements in a specific way, you need to use a sorting algorithm. There are several sorting algorithms available, but two of the most commonly used are…

javascript2 min read
2023

jquery mobile or desktop

jQuery Mobile or Desktop? As a web developer, I have had some experience with both jQuery Mobile and jQuery Desktop. Both frameworks have their pros and cons, and which one to use really depends on the specific project…

javascript1 min read
2023

node.js folder structure

Node.js Folder Structure If you are new to Node.js, it can be daunting to create a folder structure that will work for your project. The structure you choose will depend on the size and complexity of your project. Here…

javascript1 min read
ESC