I am working on a node js application and using DB as mysql what I am trying to do is when I run a query and all data is fetched I want to access the data or store that data to variables for further use
In my controller I am writing this code
exports.login = function(req, res) {
User.fetchUser()
.then(([rows]) => {
console.log(rows)
})
.catch(err => console.log(err));
}
this one is printing on console like [ BinaryRow { email: '[email protected]', password: 'dheeraj' } ]
in my model class I am executing my fetchUser function
static fetchUser() {
const email = '[email protected]'
const password = 'dheeraj'
let sql = 'SELECT email,password FROM tpconsumer where email = ? and password = ?'
return db.execute(sql, [email, password]);
}
Now what I am trying to do is get email and password values and store them in variable for further use, or simply how can I use email or my password I want to access them
[ BinaryRow { email: '[email protected]', password: 'dheeraj' } ]?