title: Adding async await in node js
body: <p>I am using node js function i have written the code long before but i need to add async and await in my functions i don know how to proceed with my code structure  .</p>
  <p>Here is my code structure</p>
  <pre><code>app.express.get('/api/member/logout', function (request, response) {
  
          functionBal.logout(request.query.abc).then(function (result) {
              
              if (result) {
                  response.set('Content-Type', 'application/json');
                  response.status(200);
                  response.json(result);
              }
          }).catch(function (err) {
              response.set('Content-Type', 'application/json');
              response.status(400);
              response.json(&quot;Error   -- &quot; + err);
          });
      });
  
  
  
  module.exports.log = function (abc) {
      return new app.promise(function (resolve, reject) {
          functionDal.log(abc).then(function (result) {
              if (result)
                  resolve(result);
              else {
                  reject(&quot;Error&quot;);
              }
          }).catch(function (err) {
              reject(err);
          });
      })
  };
  
  
  module.exports.log = function (abc) {
      return new app.promise(function (resolve, reject) {
          mySqlConnection.connection().then(function (con) {
             
              con.query(&quot;UPDATE member SET table1 = 0 WHERE abc = ?&quot;, [abc]).then(function (rows, fields) {
                  resolve('success');
              }).catch(function (err) {
                
                  reject(err);
              });
          }).catch(function (err) {
             
              reject(err);
          });
      });
  }
  </code></pre>
  <p>Please help in adding async await in this coding structure</p>