markkazanski
markkazanski

Reputation: 449

React.js & backend on App Engine as services?

I am deploying a React.js front-end (built with create-react-app) and a back-end with a CRUD API that connects to Cloud SQL.

Is this a good way?

I'm familiar with deploying to Heroku, which had front-end and back-end on different ports. Would that work for App Engine?

This is all in Node.js.

Upvotes: 4

Views: 2072

Answers (2)

Rishabh Jain
Rishabh Jain

Reputation: 78

The design pattern is good.

You only need to create a dispatch.yaml file which is only one per project.

Your dispatch.yaml file would look something like this:

dispatch:
  - url: "*/backend/*"
    service: backend

Then your frontend at project-id.appspot.com will simply make requests to https:/project-id.appspot.com/backend/ *, and these requests will be redirected to the API service.

Upvotes: 1

komarkovich
komarkovich

Reputation: 2319

I don't see any issues with the described design.

To get you on track you can take a look in Stack Overflow thread How to deploy create-react-app to Google Cloud or the following tutorial.

You can run applications on different ports with setting port forwarding in your app.yaml file.

Upvotes: 2

Related Questions