I'm using knexjs to query my DB. The problem is, that I want to get some data from the DB and export it so it can be used in other files. there's my code:
async function ebay() {
return new Promise(function(resolve, reject) {
db.select("*")
.from("ebay_site_credentials")
.then(data => {
var z = {
name: data[0].name,
pass: data[0].pass
};
resolve(z);
})
.catch(err => {
console.log(err);
});
});
}
async function app() {
var a = await ebay();
return a;
}
var a = app();
console.log(a);
I want to export clientID, secretID and base64 in a module.exports = {}
but all I get is either undefined or Promise: {}
Any ideas?
Thank you!