How to exit from in node JS program Programmatically

frugalisminds_58

FrugalisMinds

Posted on August 18, 2021

How to exit from in node JS program Programmatically

 One of the way is by using Control + c ,  but what we are  you are getting here is we want to close our program programmatically. In order to achieve this we are going to use the process module present in NodeJS
. Lets see How and Is it a good way of doing it ?

const express = require('express')

const app = express()

app.get('/', (req, res) => {
  res.send('Hi Nodejstuts!')
})

const server = app.listen(3000, () => console.log('Server Listening In Nodejstuts'))
Enter fullscreen mode Exit fullscreen mode

Have a look at few other scenarios here .

💖 💪 🙅 🚩
frugalisminds_58
FrugalisMinds

Posted on August 18, 2021

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related