title: CORS issue with React.js + Node.js(express)
body: <p>I'm connecting my react-app with mysql now.</p>
  <p>I tried proxy(in package.json), app.use(cors()) also Google chrome Cors Extension for catch this cors issue, but i couldn't. I need your help.</p>
  <p>ERROR MSG</p>
  <pre><code>Access to XMLHttpRequest at 'localhost:4000/api/test' 
  from origin 'http://localhost:3000' has been blocked 
  by CORS policy: Cross origin requests are only supported
  for protocol schemes: http, data, chrome, chrome-extension, 
  chrome-untrusted, https.
  xhr.js:177 GET localhost:4000/api/test net::ERR_FAILED
  </code></pre>
  <p>I added this line in <em>package.json</em>
  <code>&quot;proxy&quot;: &quot;http://localhost:4000/&quot;,</code></p>
  <p><em>server.js</em></p>
  <pre><code>const express = require(&quot;express&quot;);
  const cors = require(&quot;cors&quot;);
  const app = express();
  const PORT = process.env.PORT || 4000;
  const db = require(&quot;./config/db&quot;);
  
  app.use(cors());
  
  app.get(&quot;/&quot;, cors(), (req, res) =&gt; {
    res.send(&quot;hello route / &quot;);
  });
  
  app.get(&quot;/api/test&quot;, cors(), (req, res) =&gt; {
    res.header(&quot;Access-Control-Allow-Origin&quot;, &quot;*&quot;);
    db.query(&quot;SELECT * FROM travel_test&quot;, (err, data) =&gt; {
      if (!err) res.send({ data });
      else res.send(err);
    });
  });
  
  app.listen(PORT, () =&gt; {
    console.log(`Server On : http://localhost:${PORT}/`);
  });
  
  </code></pre>
  <p><em>api.js</em></p>
  <pre><code>import axios from &quot;axios&quot;;
  
  const api = axios.create({
    baseURL: &quot;localhost:4000/api/&quot;,
  });
  
  export const cityApi = {
    test: () =&gt; api.get(&quot;test&quot;),
  };
  
  </code></pre>