Skip to content

Instantly share code, notes, and snippets.

@mpareja
Created January 23, 2014 19:38
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 mpareja/8585353 to your computer and use it in GitHub Desktop.
Save mpareja/8585353 to your computer and use it in GitHub Desktop.
level seems to clear restify's per-request domain
// 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