Deploying a Golang-React app on a web server

Hi Guys!

I am relatively new to Go, and have been working on building a simple web app using Golang as backend and React as frontend

I am having trouble compiling + deploying everything on a live server. Would be extremely grateful if you could point me in the right direction on this.

The steps I have followed are as follows:

  1. Compiled Golang app into a linux executable + uploaded to public_html in cpanel
  2. Added website name to package.json file
  3. Ran the npm run build to produce a build folder
  4. Uploaded and unzipped contents of build folder inside public_html
  5. Ran the golang executable on console of cpanel with PORT=1234 ./app-name

The static front end displays fine and the app runs on the server console just fine - but it seems to have trouble relaying any data between backend and frontend.

Thank you very much!

Hi @ya1220, welcome to the forum!

If the app works fine locally, then I would guess this is a problem of the environment you uploaded the app to.

A few things to try:

  • Check if the app really listens on port 1234
  • Maybe try a different port
  • Add logging to the app, or improve the existing logging to get more details about where it might get stuck

HTH

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.