I have a frontend create-react-app and a backend API using Expressjs.
I deployed the backend API to Google App Engine successfully.
But now I need to deploy the create-react-app to Google Cloud and it becomes very confusing, I tried to google for a while and there is no true/recommended way for this.
At least I saw that other people suggested doing it in 2 ways:
Using Google Cloud Storage:
Run "npm run build" to create the "build" folder
Upload this whole folder onto a bucket
=> I see that there is one drawback using this way: When I tried to reload page 'url/aboutUs', it's not found. So I have to go back to 'url' then click the About Us link
=> I guess that the React Router that I'm using is not working with Google Cloud Storage
=> People just talked about using it, but I can't find any guide/tutorial for this.
So what is the recommended way to deploy create-react-app to Google Cloud?
And can you please provide a tutorial for that?
Thanks.
You just need to configure the Cloud Storage bucket to serve index.html
as the 404 page.
For Google App Engine, you can use serve or set up nginx to serve index.html
in the build folder.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With