Skip to content

Instantly share code, notes, and snippets.

@othiym23
Forked from hayes/cls.js
Last active August 29, 2015 13:57
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 othiym23/9839712 to your computer and use it in GitHub Desktop.
Save othiym23/9839712 to your computer and use it in GitHub Desktop.
var cls = require('continuation-local-storage')
, concat = require('concat-stream')
, http = require('http')
var foo = cls.createNamespace('foo')
foo.run(function () {
http.createServer(function(req, res) {
req.pipe(concat(done))
function done() {
res.write(JSON.stringify(foo.active)) //null
res.end()
}
}).listen(6789)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment