These are samples for using Node.js on Google App Engine Flexible Environment. Many of these samples are referenced from the documentation on cloud.google.com.
There are also samples submitted by the community.
See our other Google Cloud Platform GitHub repositories for sample applications and scaffolding for other frameworks and use cases.
Some samples have specific instructions. If there is a README.md
file in the
sample folder, please refer to it for any additional steps required to run the
sample.
The App Engine Node.js samples typically that you do the following:
-
Acquire local credentials for authenticating with Google Cloud Platform APIs:
gcloud auth application-default login
-
Clone this repo:
git clone https://github.com/GoogleCloudPlatform/nodejs-docs-samples.git
-
Choose a sample:
cd appengine/sample-folder/
-
Install depedencies using
npm
oryarn
:npm install
or
yarn install
-
Run the sample with
npm
oryarn
(See the sample'sREADME.md
file for any additional setup):npm start
or
yarn start
-
Visit the application at [http://localhost:8080][].
Some samples in this repositories may have special deployment instructions.
Refer to the README.md
file in the sample folder.
-
Use the Google Cloud Console to create a Google Cloud Platform project.
-
Enable billing for your project.
-
Use the Cloud SDK to deploy your app.
gcloud app deploy
Note: If there is a
yarn.lock
file thenyarn install
will be used during deployment. Delete theyarn.lock
file to fall back tonpm install
. -
View your deployed application at
https://YOUR_PROJECT_ID.appspot.com
.
View the Official App Engine Node.js samples.