Skip to content

Instantly share code, notes, and snippets.

@piscisaureus
Created January 17, 2012 22:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save piscisaureus/1629308 to your computer and use it in GitHub Desktop.
Save piscisaureus/1629308 to your computer and use it in GitHub Desktop.
// An express router
app.get('/view/{file}', function(req, res, o) {
var d = domain(function() {
var renderer = new MyTemplateRenderer(o.file);
renderer.on('data', function(buf) {
// is this allowed?
res.write(buf, function() {
// In which domain does this run?
});
});
});
d.on('error', function(e) {
if (res.writable) {
res.write(e);
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment