前回に引き続きconnect.jsを読む。今回はconnect/http.js。ここがconnectのコア。 まず最初にコンストラクタ。ここでhttp.Serverを継承してる。んでhttp.Server.call(this, this.handle)ってやってるのでリクエストハンドラをthis.handleにしてる。リクエストは全部このthis.handleで処理されるということになる。 var Server = exports.Server = function HTTPServer(middleware) { this.stack = []; middleware.forEach(function(fn){ this.use(fn); }, this); http.Server.call(this, this.handle); }; /** * Inherit from `http.