title: Can't fetch data with fetch API
body: <p>I can't get the fetch() API to work. I get the strong feeling I'm doing something incorrectly.</p>
  
  <p>I have a simple express server running on PORT 3005, which return data in json format, and a react.js client running on PORT 3000.</p>
  
  <p>I'm using <code>fetch()</code> to make a GET request to <code>http://localhost:3005/api</code> but am getting these messages on the console</p>
  
  <blockquote>
    <p>Cross-Origin Request Blocked: The Same Origin Policy disallows reading
    the remote resource at <a href="http://localhost:3005/api" rel="nofollow noreferrer">http://localhost:3005/api</a>.
    (Reason: CORS header ‘Access-Control-Allow-Origin’ missing).</p>
    
    <p>TypeError: NetworkError when attempting to fetch resource.</p>
  </blockquote>
  
  <p>I added a header and read through similar questions but I still can't get it to work, and I'm still getting the same messages.</p>
  
  <p>What am I doing wrong? (Here's the code)</p>
  
  <pre><code>let url = 'http://localhost:3005/api';
      fetch(url, { 
        method: 'GET',
        headers:{
          'Access-Control-Allow-Origin': '*',
          'Access-Control-Allow-Credentials':true,
          'Access-Control-Allow-Methods':'POST, GET'
        }
      }).then(response =&gt; response.json)
      .then(data =&gt; console.log(data))
  </code></pre>
  
  <p>I've run into this issue several times in the past, and usually just use axios. But this time, I want to get <code>fetch()</code> to work...!</p>