我有一个非常基本的节点脚本,它启动,提供一个 html 页面,最后关闭应用程序(理想情况下杀死节点进程)。一切都很好,除了最后一行调用 close 方法将其拆除。
var express = require('express')
, http = require('http')
, app = express()
, server = http.createServer(app);
app.get('/', function(req, res) {
res.sendfile(__dirname + '/index.html');
});
app.listen(8090);
console.log("started...");
app.close();
我在使用节点 0.8+ 运行此程序时遇到的错误是
app.close();
^
TypeError: Object function app(req, res){ app.handle(req, res); } has no method 'close'
有谁知道我怎样才能更安全地关闭快递应用程序?