为了不崩溃服务器,我们在main.js中捕获任何未捕获的异常。但是,请求不会终止。有没有办法终止活动请求?
//keep server from crashing by catching all exceptions not caught before
process.on('uncaughtException', function(err) {
console.log(err);
//kill request that caused the error
});
//launch server
https.createServer(options, app).listen(appSettings.ports.https, function(){
console.log('Express https server listening on port %d in %s mode',appSettings.ports.https, app.settings.env);
});