Quitting node.js gracefully

后端 未结 5 638
天涯浪人
天涯浪人 2020-11-30 19:27

I\'m reading through the excellent online book http://nodebeginner.org/ and trying out the simple code

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

function onRequest(req         


        
5条回答
  •  北荒
    北荒 (楼主)
    2020-11-30 19:55

    1) How do I shut down node.js gracefully?

    Listening for a SIGINT signal. On Windows you need to listen for a ctrl-c with the readline module.

    I've written my own solution to provide an application a graceful shutdown and the usage of domains: grace. It's worth to have a look.

提交回复
热议问题