Created
January 17, 2012 22:06
-
-
Save piscisaureus/1629308 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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