Created
May 13, 2015 10:04
-
-
Save epappas/5feb22ab1f1d2113f6fb to your computer and use it in GitHub Desktop.
Domains in express
This file contains 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
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