Tutorial by Examples

By using server.close() and process.exit(), we can catch the server exception and do a graceful shutdown. var http = require('http'); var server = http.createServer(function (req, res) { setTimeout(function () { //simulate a long request res.writeHead(200, {'Content-Type': 'text/plain'})...

Page 1 of 1