4

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?

  • React.js front-end is a default service.
  • Back-end API is backend service

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.

markkazanski
  • 439
  • 7
  • 20

2 Answers2

2

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.

komarkovich
  • 2,223
  • 10
  • 20
  • If I make an AJAX call from react to the backend service, would I need to use the absolute URL? Like this: `https://service-dot-project-id-appspot.com/api/request` – markkazanski Aug 07 '18 at 16:13
1

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.

Rishabh Jain
  • 78
  • 1
  • 8