title: NodeJS wait for HTTP request
body: <p>I want to write an application that requests a token from an API. As long as this token isn't available I don't want to continue with the rest of the application. So it has to be like a synchronous HTTP request.</p>
  
  <p>My goal is to create a function that does the request and then returns the token like:</p>
  
  <pre><code>var token=getToken();  //After this function has finished
  makeRequest(token);   //I want this function to be executed
  </code></pre>
  
  <p>How can I do this? </p>