title: How to deploy/connect a React/Flask-RESTful app?
body: <p>I am relatively new to web development so if what I am trying to do here is not a common practice in the community, please de not hesitate to correct me.</p>
  
  <p>I have written a simple <strong>react</strong> app that communicates with a <strong>Flask-rest</strong> API at the back-end via HTTP requests. For test use, I am running the React app and the Flask api separately on different ports on localhost and connect them using a proxy configuration, so the url for the HTTP request could remain <strong>relative</strong> (e.g. <code>/getUser/user_id</code> etc)</p>
  
  <p>My question is, how would I deploy the APP and the API onto the same server so the structure would not change? Or do I need two different servers to host each of them? I might as well admit that really don't understand how a server actually works... If I run <code>yarn build</code> for the React app, should I put the the build folder together with the Flask API?</p>
  
  <p>A related question is that, I have saved several static files on the back-end and I would like my front-end React app to have access to them and so far I have tried Flask's <code>send_from_directory()</code> function to make it work. Is this the right/common way to serve a static file on the server? I have seen people mentioned <strong>Nginx</strong> but I don't quite understand that..</p>
  
  <p>Any answers or comments are appreciated. Thanks for helping a new programmer out </p>