このエクスプレスJSソーススニペットを理解し、これはExpressは、私は、コードカントは、私はエクスプレスJSのソースを理解しようとしていた
var app = function(req, res, next) {
app.handle(req, res, next);
};
のこの作品について混乱しています
module.exports = createApplication;
function createApplication() {
var app = function(req, res, next) {
app.handle(req, res, next);
};
mixin(app, EventEmitter.prototype, false);
mixin(app, proto, false);
// expose the prototype that will get set on requests
app.request = Object.create(req, {
app: { configurable: true, enumerable: true, writable: true, value: app }
})
// expose the prototype that will get set on responses
app.response = Object.create(res, {
app: { configurable: true, enumerable: true, writable: true, value: app }
})
app.init();
return app;
}
を輸出しているメインモジュールであります変数app
が同時に割り当てられ、関数内で使用されます。これはどのように機能しますか?他の場所にはapp
の定義はありません。実際の情報源はhereです。
は、ああ。今は理にかなっている。ありがとう! –