title: json-server - Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension
body: <p>I am running an express server to serve my angularJS app on port 8000. I'm using an <code>$http.get</code> inside one of my services to hit an API.<br>
  I'm using <a href="https://github.com/typicode/json-server" rel="nofollow noreferrer">json-server</a> to host the API on 3000. When I enter the URL in the browser, I get the JSON served. But when I open the app, the following error is shown in devtools:</p>
  
  <blockquote>
    <p>XMLHttpRequest cannot load localhost:3000/techData. Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.</p>
  </blockquote>
  
  <p>this is the angularjs service:</p>
  
  <pre><code>techApp.factory('techData', function ($http) {
    let data;
    $http.get('localhost:3000/techData')
      .then((response) =&gt; {
        data = response.data;
      });
  
      return {
        techData: data
      };
  });
  </code></pre>
  
  <p>I saw <a href="https://github.com/typicode/json-server/issues/124" rel="nofollow noreferrer">this issue</a> and learnt that json-server allows cross origin requests.</p>