Skip to content

Instantly share code, notes, and snippets.

@epappas
Created May 13, 2015 10:04
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 epappas/5feb22ab1f1d2113f6fb to your computer and use it in GitHub Desktop.
Save epappas/5feb22ab1f1d2113f6fb to your computer and use it in GitHub Desktop.
Domains in express
function __domains(req, res, next) {
var d = domain.create();
d.id = crypto.randomBytes(32).toString('base64');
d.add(req);
d.add(res);
d.run(function() {
next();
});
d.on('error', function(e) {
next(e);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment