How to restart Node.js server from code? For example, if using expressjs framework,
app.get(\'/restart\', function (req, res, next) {
//Code to restart a se
By combining npm restart and child_process.exec() it appears possible to restart the server programmatically. And since it allows for several scripts to be run for stopping, restarting, and starting this option would work even for multi-process servers or otherwise complex servers where simply calling process.exit()
isn't viable.