9

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:

  1. 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

  1. Using Google App Engine

=> 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.

1 Answer 1

3

You just need to configure the Cloud Storage bucket to serve index.html as the 404 page.

enter image description here

For Google App Engine, you can use serve or set up to serve index.html in the build folder.

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

2 Comments

Thank you @riwu. Can you please provide a tutorial that use "serve" with Google App Engine?
Run serve -s build in the directory containing your build folder. You still need to set up redirects and using node for serving static assets results in higher overhead. I'd recommend using the Cloud Storage bucket.

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.