Deploying Your Web Service

This section of the guide shows how to use the gcloud tool to deploy your Node.js web service on App Engine. To learn more about the Node.js runtime environment, see Node.js Runtime Environment.

Before you begin

Key points

  • Use gcloud app deploy and gcloud app browse to deploy and view your service.

Deploying your service

In your my-nodejs-service folder, where the app.yaml file is located, run the following command in your terminal:

gcloud app deploy

Your project files are then packaged and uploaded to Google Cloud Storage.

Node.js modules are installed in the cloud as listed in your package.json and package-lock.json files and your service is started by using npm start.

Viewing your service

To quickly launch your browser and access your web service at https://YOUR_PROJECT_ID.appspot.com, use the following command:

gcloud app browse

Services and versions

You've just created and deployed a service on App Engine. You can specify the name of your service in the app.yaml file. If the name is omitted, it is treated as default. The first service you deploy must be the default service.

You can update your service at any time by running the gcloud app deploy command again. Each time you deploy, a new version is created and traffic is automatically routed to the latest version.

To confirm that your service has been created and a version has been deployed:

  1. View your App Engine services in the GCP Console:

    View services

    You should see one service listed, named default. The default service is publicly accessible at the following URL:

    https://YOUR_PROJECT_ID.appspot.com
    

  2. View your versions:

    View versions

    You should see one timestamped version listed, corresponding to your deployment.

Note that you can deploy multiple services other than the default service. For more information on the multi-service design pattern, see An Overview of App Engine. To learn how to send requests to specific services and versions, see How Requests are Routed.

Next steps

Now that you have a Node.js server running on App Engine, learn how to make updates to your web service.

Was this page helpful? Let us know how we did:

Send feedback about...

App Engine standard environment for Node.js docs