Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Deploy a React app running on NodeJS to Google App Engine in minutes

NotificationsYou must be signed in to change notification settings

mikesparr/app-engine-react-demo

Repository files navigation

Sometimes finding a working example for what is supposed to be a simple task is a challenge. Thisrepo contains a current (July 2020) example of how to configure theapp.yaml to deploy acreate-react-app default build to Google's App Engine standard.

Prerequisites

  • NodeJS
  • Google Cloud SDK (gcloud CLI)
  • Active Google Cloud Platform (GCP) project

Example

App Engine React Demo

Usage

  1. Download thesetup.sh,teardown.sh, andapp.yaml files to your computer

  2. Create a.env (dotenv) file:

cat> .env<<EOFexport APP_NAME="app-engine-react-demo"export PROJECT_ID="<YOUR GCP PROJECT ID>"EOF
  1. Run the setup script
./setup.sh
  1. Wait several minutes and then view the app in your browser

App Engine Config

The tricky part is getting the app config working. There are some examples for App Engine (flex) and differing approaches for flex and standard, but this is a concise working example that will deploy the artifacts from the/build folder after runningnpm build.

# app.yamlenv:standardruntime:nodejs10service:app-engine-react-demohandlers:  -url:/staticstatic_dir:build/static  -url:/(.*\.(json|ico|js))$static_files:build/\1upload:build/.*\.(json|ico|js)$  -url:.*static_files:build/index.htmlupload:build/index.html

Cleanup

To avoid unexpected charges be sure to either delete your project or delete the app you deployedusing the providedteardown.sh script.

./teardown.sh

If you deploy multiple times, you might have to first deleteversions usinggcloud app versions list and thengcloud app versions delete <version id>.

About

Deploy a React app running on NodeJS to Google App Engine in minutes

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp