title: Angular 2, localhost/null error when trying to use http.get?
body: <p>I am using Angular 2 to make a webpage. When I load the page, I use OnInit to run the following method (with generic names substituted):</p>
  
  <pre><code>getAllObjects(): Promise&lt;object[]&gt;{
      return this.http.get(this.getAllObjectsUrl).toPromise().then(response =&gt; response.json().data).catch(this.handleError);
  }
  </code></pre>
  
  <p>I've verified in my browser that the getAllObjects url does indeed return an array of <code>object</code> in JSON format. Here is the url if it is helpful:</p>
  
  <pre><code>private getAllObjectsUrl : 'http://99.240.124.235:7060/REST/rest/companyService/getAllCompanies.json/';
  </code></pre>
  
  <p>However, this method triggers the handleError catch and the browser's debugging log shows <code>GET localhost:3000/null 404 NOT FOUND</code> (I am using an npm server to run it, hence the localhost).</p>
  
  <p>I do not believe it is a CORS issue because I downloaded the Chrome CORS plugin and other API calls have worked. It is only this particular API url that is causing a problem, which I find strange as my other API calls work and they follow the exact same format (except a different url). </p>
  
  <p>I thought maybe the <code>appComponent</code> wasn't allowed an OnInit, but I replaced <code>getAllObjects()</code> with a different working API call, and I didn't receive this error.</p>
  
  <p>I am completely stuck and any help would be appreciated (could this error be because of the web API, not the front end?).</p>