I have the following code which isn't returning data properly.
app.post('/login',function(req,res){
    sess=req.session;
    var au = authme(req.body.name,req.body.pass, function(err,data) {
            if(err) {
                    return 'error';
            }
            console.log(data);
            return data;
    });     
    if(au) {
            sess.username = au.name;        
    }
    res.end('done');
});
Data is passed all the way to console.log(data); but when I try to use in in the au statement, its returning undefined.
 
     
     
    