-
-
Notifications
You must be signed in to change notification settings - Fork 26
Closed
Description
const app = require('express')();
const httpContext = require('express-http-context');
var db = require('odbc')();
const cn = "DRIVER={ODBC Driver 13 for SQL Server};SERVER=SOMESERVER,SOMEPORT;DATABASE=somedb;Trusted_Connection=Yes"
app.use(httpContext.middleware);
app.get('/', (req, res) => {
httpContext.set('foo', 'bar');
console.log(httpContext.get('foo')); // prints 'bar'
db.open(cn, (err) => {
if (err) throw err;
console.log(httpContext.get('foo')); // prints undefined!
...
});
});
...
My environment is
RedHat Enterprise Linux 7.2 (maipo)
Node: 6.9.1
npm: 5.6.0
express-http-context: 1.0.4 (have tried 1.0.0 as well)
Metadata
Metadata
Assignees
Labels
No labels