title: Calling a third party API in NodeJs
body: <p>I want to call a third party API in my controller and I want to use the returned values outside of the call. I am very new to Node and could not find anything useful as a solution.</p>
  
  <p>I want it to work as follows:</p>
  
  <pre><code>exports.submit = async function(req, res) {
    var options = {
      'method': 'POST',
      'url': 'https://third/party/api/url',
      'headers': {
        'X-API-KEY': 'E6xwOg2BY4RbmiJogfyegrt746r7te',
        'Content-Type': 'application/json'
      }
    };
    request(options, function (error, response) {
      if (error) return error;
      var result = JSON.parse(response.body);
    });
    // I want to print/use 'result' here. how can I do that?
  }
  </code></pre>
  
  <p>Please help me in this issue.</p>