skip to Main Content

I want to deploy my react application on github. I have a confusion while deploying it.

  1. Should i deploy both front end and backend separately?
  2. When i host the project, how to maintain connection to the mongoDb database i made locally?

Front end : https://github.com/learnfromscratches/connections-frontend.git
Backend : https://github.com/learnfromscratches/Connections-backend.git

I don’t have any idea about hosting. How should i host the website and backend and get it connected?

2

Answers


  1. Github can only deploy static websites, and back -end services should try to deploy on cloud service manufacturers such as Vercel.

    Login or Signup to reply.
  2. If you want to use Github Pages as a hosting site, you could only deploy the React part of it (frontend).
    To deploy the backend project you should use other sites like Vercel or Render (check https://www.freecodecamp.org/news/how-to-deploy-nodejs-application-with-render/) or even AWS or Azure.
    As for your database connection you should also deploy it or host it on any of those plaforms (e.g: https://docs.aws.amazon.com/dms/latest/sbs/chap-mongodb2documentdb.02.html) and then addd the string connections on your deployed node server.

    If you are doing it for testing purposes only I would recommend hosting your apps on separate Docker containers on your local machine, to simulate they are in different machines. Check: https://www.linuxandubuntu.com/home/host-multiple-websites-on-docker-containers

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search