function Request(type, name, root) { this.children = []; this.name = name; this.type = type; if (root === true) { var reqDomain = domain.create(); reqDomain.enter(); } if (process.domain) { this.parent = process.domain.currentRequest; } this.id = nextEventId; ++nextEventId; if (this.parent) { this.top = this.parent.top; this.parent.children.push(this); } else { this.top = this; if (this.type) { /* If we're the top and we're a type, we get a request Id, not an event Id */ this.id = nextRequestId; ++nextRequestId; } } }
app.use(function(req, res, next) { var reqDomain = domain.create(); reqDomain.on('error', function(err) { res.render('error'); }); reqDomain.run(next); });
var d = domain.create();
var d = domain.create();
App.use((req, res, next) => { const d = domain.create(); d.add(req); d.add(res);
var d = domain.create();