How to Promisify this function - nodejs
<p>I have an ajax call which needs to return a promise. The function is as follows</p>

<pre><code>client.tickets.create(ticket,  function(err, req, result) {
  if (err) {    
    logger.error(err);

    return false;
  }

  return JSON.stringify(result);
});
</code></pre>

<p>I have to wait for this function to execute before I can perform the next action. How can I promisify this function ?</p>

<p>I tried the following and it gave me an error saying <code>Cannot call method then of undefined</code>:</p>

<pre><code>return client.tickets.create(ticket).then(function(result){
    return JSON.stringify(result);
},function(err){
    logger.error(err);
    return false;
});
</code></pre>