title: Host React and Express on the same server?
body: <p>I am working on a react site that has a contact page. On the contact page there is a text field where you enter a message that will be sent to a specific email address.</p>
  
  <p>Right now I'm just trying to set up express with my react app, the <em>only</em> thing I need Express for is this one feature.</p>
  
  <p>In my react app I am doing</p>
  
  <pre><code>$.post('http://localhost:3030/API',{value:'hi'}, function(result) {
    console.log(result);
  });
  </code></pre>
  
  <p>And in my Express <code>index.js</code> file I'm doing</p>
  
  <pre><code>app.get('/API', (request, response) =&gt; {  
    console.log(request);
  })
  </code></pre>
  
  <p>Just as a simple test to see if things are working properly.</p>
  
  <p>When I run these both and attempt to execute my <code>post</code> function, I get the <code>No 'Access-Control-Allow-Origin' header is present on the requested resource.</code> error, which is basically saying that I <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS" rel="noreferrer">can't make a request to a separate domain</a>. The issue here is not that error, but the fact that I am running my Express server and react app on two different servers.</p>
  
  <p>Is there a way to have them on the same server? I am very new to back-end development, any help would be very appreciated!</p>