title: Wait for return value NodeJS
body: <p>I have a node server which makes a call to an external module. My problem is that I need the data return by the call to the module but node (which is non-blocking) simply isn't waiting for the return value. Any solution to this ?</p>
  
  <p>Code :</p>
  
  <p><strong>Server.js</strong></p>
  
  <pre><code>var value = module.functionA(param);
  console.log("Message one %s", value);
  </code></pre>
  
  <p><strong>Module.js</strong></p>
  
  <pre><code>function callToFunctionInModule(param){
  console.log("In func");
  return param+2;
  }
  
  exports.functionA = function(param){
  console.log("Message two");
  var returnVal = callToFunctionInModule(param);
  return returnVal;
  };
  </code></pre>
  
  <p><strong>Ouput</strong></p>
  
  <pre><code>Message two
  Message one undefined
  In func
  </code></pre>
  
  <p>Is there anyway to get the following output (waiting to get the return value from the module WITHOUT using callback in the line <em>var value = module.functionA(param);</em></p>