3

I have 2 separate projects. One is for frontend reactJs another for backend NodeJs and I am using mySQL database to fetch data from. My main issue is, I am not able to host this website on internet.

I tried using firebase hosting and was able to host frontend reactJs project. I still have NodeJs and MySql db that needs to be hosted in order for the website to function. Also, what changes do I need to make in the connection file to DB, from front end the api firing is done using axios ("http://localhost:3000") . Do I need to change this as well? I am completely new to this hosting process.

1 Answer 1

3

It's great that you managed to deploy your front-end app. As you said now you have to also deploy the back-end one to which your React app is making requests. What I can recommend is to use an online hosting platform (I personally use DigitalOcean) and rent a Droplet which is basically a piece of a server running on Linux (or other OS) on which you have full control. You have to prepare the environment so that you can deploy both the database and the NodeJs app there.

After you succesfully prepare the environment and deploy your node app there you can use the Droplet's IPv4 concatenated with the port the app is using to send the requests from your React application. Example:

'instead of http://localhost:3000 use http://your_ipv4_adress:3000'

I would recommend to use Ubuntu as the Droplet's OS as there are a lot of online tutorials on how to prepare the environment and deploy apps for different tools and frameworks.

Hope I helped you, cheers!

Sign up to request clarification or add additional context in comments.

1 Comment

And as about the Database you have to create it on the Droplet exactly how you did on your local machine and use the credentials that your node app is using.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.