I got my App online… and a database.
--
How to publish a web application using React and connect to a MySQL database using a PHP file as a backend.
I decided to write this article partially to have a place to refer to in case I need to create again the connection from a web application done in React and a MySQL database. The other reason is to share the steps with others that might face the same challenges I encountered.
I am using a MySQL database hosted on DreamHost which is the same domain provider of my website guidosalimbeni.it , and I had to include some information inside the databases configuration from the control panel.
In essence, I had to include all the additional domains from which the request to a PHP file (I would create later) can come. For instance, while testing I add to add the IP address of my personal computer.
After I create a PHP file that acts as a backend to receive the post request from the front end application and send the data to the MySQL database.
I then uploaded this file inside a folder of my website using the file manager tool in the control panel of my host provider. So the URL of this file is simply www.guidosalimbeni.it/folderlocation/file.php
The final step was to write the submit request code in the React application.
The app is online here https://aironic.vercel.app/