Stop node.js program from command line

后端 未结 19 2268
无人及你
无人及你 2020-11-29 14:51

I have a simple TCP server that listens on a port.

var net = require(\"net\");

var server = net.createServer(function(socket) {
    socket.end(\"Hello!\\n\"         


        
19条回答
  •  自闭症患者
    2020-11-29 14:58

    If you are running Node.js interactively (the REPL):

    Ctrl + C will take back you to > prompt then type:

    process.exit()
    

    or just use Ctrl + D.

提交回复
热议问题