I'm having alot of trouble getting couchdb's response handlers to do anything useful with node.js and now.js. My aim is to call back to a client or group with certain information that's been found and also sent from a client.
everyone.now.login = function(){
var username = this.now.lusername;
var password = this.now.lpassword;
var test;
db.get(this.now.lusername, function (err, doc, test, username) {
if (err) {
console.log(+ username + " doesn't exist!");
} else {
console.log('Found user!');
console.log(doc);
test = 1;
}
});
console.log(test);
}
I'm using test as an example here. I declare it outside db.get, assign a value inside to feed back but when console.log is run outside it doesn't have a value.
Am I simply not getting it or is something wrong?
(I do release I can use doc.(whatever value) but there is a particular variable i wanted to pass on back to the client outside of this call)