title: NodeJS - How to get the data return from a promise and export it
body: <p>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:</p>
  
  <pre><code>async function ebay() {
    return new Promise(function(resolve, reject) {
      db.select("*")
        .from("ebay_site_credentials")
        .then(data =&gt; {
          var z = {
            name: data[0].name,
            pass: data[0].pass
          };
  
          resolve(z);
        })
        .catch(err =&gt; {
          console.log(err);
        });
    });
  }
  
  async function app() {
    var a = await ebay();
  
    return a;
  }
  
  var a = app();
  console.log(a);
  </code></pre>
  
  <p>I want to export clientID, secretID and base64 in a module.exports = {}</p>
  
  <p>but all I get is either undefined or Promise: {}</p>
  
  <p>Any ideas?</p>
  
  <p>Thank you!</p>