Created
January 23, 2014 19:38
-
-
Save mpareja/8585353 to your computer and use it in GitHub Desktop.
level seems to clear restify's per-request domain
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
// Launch this server and hit it with your browser. | |
// In the console you'll see: | |
// | |
// Has domain before level: true | |
// Has domain after level: false | |
var domain = require('domain'); | |
var restify = require('restify'); | |
var level = require('level'); | |
var db = level('./testdb'); | |
var server = restify.createServer(); | |
server.get('/', function (req, res, next) { | |
console.log('BEGIN'); | |
console.log("Has domain before level: " + !!domain.active); | |
db.get('bogus', function () { | |
console.log("Has domain after level: " + !!domain.active); | |
res.send(200); | |
next(); | |
}); | |
}); | |
server.listen(8080); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment