title: Node.js http.get returning "undefined" in function
body: <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var exports = module.exports = {};
  var http = require('http');
  
  exports.get = function(key, app, vari) {
      http.get('&lt;url here&gt;/?key='+key+'&amp;app='+app+'&amp;var='+vari+'&amp;req=0', function (response) {
          response.setEncoding('utf8');
          response.on('data', function(body) {
              console.log(body);
              return body;
          });
      });
  };</code></pre>
  </div>
  </div>
  </p>
  
  <p>My code (seen above) will output the response to the console just fine, but when trying to use the function in an export, it returns 'undefined' no matter what. The responses it receives are one line and are in the content type of "application/json". What's up with it? (And no, it's not the "url here", I just removed the URL for privacy reasons. If it helps, I can provide it.)</p>