title: cors error fetching from react app to localhost express server
body: <p>my react app runs on localhost:3000</p>
  
  <p>and my express server runs on localhost:1234</p>
  
  <p>this is my express server:</p>
  
  <pre><code>const express = require("express")
  const cors = require("cors")
  const app = express();
  const PORT = 1234;
  const spawn = require("child_process").spawn;
  
  app.use(cors())
  
  app.listen(PORT,  function(){
  console.log(`listening on port:${PORT}...`)
  })
  
  app.get("/api/play/:choice", function(req,res){
      res.status(200).send("lets go")
      /*pythonProcess = spawn('python',["./script.py", req.params.choice]);
      pythonProcess.stdout.on('data', function(data) {
      res.status(200).send(data.toString('utf-8'))})*/
  })
  </code></pre>
  
  <p>I have a react app fetching like this</p>
  
  <pre><code>fetch(`localhost:1234/api/play/${this.state.value}`)
  .then(function(res) {
    res.text().then(function(text){
      console.log(text)
    });
  })
  </code></pre>
  
  <p>I get this error in the console of the react server:</p>
  
  <pre><code>Fetch API cannot load localhost:1234/api/play/rock. URL scheme must be "http" or "https" for CORS request.
  </code></pre>
  
  <p>When I use postman I use postman I get the correct response back when I use it on:</p>
  
  <pre><code>http://localhost:1234/api/play/whatever
  </code></pre>