起動して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'
エクスプレスアプリをより安全に閉じる方法を知っている人はいますか?