These are samples for using Node.js on Google App Engine. 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 require 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:
npm install
-
Run the sample with
npm
(See the sample'sREADME.md
file for any additional setup):npm start
-
Visit the application at [http://localhost:8080][].
Some samples may have special deployment instructions.
Refer to the README.md
file in the sample folder.
Many samples in this folder can be deployed to both App Engine Node.js standard
environment and flexible environment. Those samples come with two different
App Engine configuration files: app.flexible.yaml
for flexible environment,
and app.standard.yaml
for standard environment.
Samples with one single configuration file, app.yaml
, can only be deployed
to one of the two environments. See the README.md
files for these samples
for more information.
Generally speaking, to deploy a sample application:
-
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.
For samples with two configuration files (
app.flexible.yaml
andapp.standard.yaml
), if you plan to use App Engine Node.js Standard Environment, rungcloud app deploy app.standard.yaml
To deploy to App Engine Node.js Flexible Environment, run
gcloud app deploy app.flexible.yaml
For samples with one configuration file (
app.yaml
), rungcloud app deploy
to deploy the app to its compatible environment.
-
View your deployed application at
https://YOUR_PROJECT_ID.appspot.com
.
View the Official App Engine Node.js samples.