title: Nodejs Return statements not working but console.log() works
body: <p>I am able to fetch data from database but returning this data as a response to a request made is the problem.</p>
  
  <pre><code> `    // create employees and save into the databse
  async save(resp) {
  
      this.bcrypt.hash(this.user.password, 10).then( (hash)=&gt;{
  
          let params = [this.user.firstName,
              this.user.lastName,this.user.email, 
              this.user.password, this.user.gender, 
              this.user.jobRole,this.user.department, 
              this.user.address];
  
         this.client.query( 
          'INSERT into employees (firstName, lastName, email, password, gender, jobRole, department, address) VALUES($1, $2, $3, $4, $5, $6, $7, $8) RETURNING userId', 
           params)
  
          .then ( (result) =&gt; {
  
              try {
                  let userFetched = result.rows[0].userid;
                  this.client.query("SELECT * FROM employees WHERE userid = $1", [userFetched])
                      .then( (res)=&gt;{
  
                          console.log(res.rows[0]);
                          return res.rows[0];
  
                      })
  
                      .catch( (err)=&gt;{
                          console.log(err);
                      })
  
  
              } catch (error) {
                  return {
                      error: "Employee could not be created correctly."
                  }
              }
  
          })
  
          .catch( (err)=&gt;{
              return {
                  error: "Something went wrong. Try again later."
              }
          })
  
  
      })
  
  }`
  </code></pre>
  
  <p>If I console the fetched data , that works but returning it is the problem. I keep getting an error. Please help.</p>