[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-08-20。"],[[["\u003cp\u003eGoogle recommends starting with Cloud Run for deploying new Node.js web services, but this guide focuses on deployment via App Engine.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003egcloud app deploy\u003c/code\u003e command uploads your source files, builds your Node.js app, and deploys it to App Engine, while \u003ccode\u003egcloud app browse\u003c/code\u003e opens the deployed web service in your browser.\u003c/p\u003e\n"],["\u003cp\u003eYou can deploy multiple services within a project by creating an \u003ccode\u003eapp.yaml\u003c/code\u003e file for each, and specifying the service name, with each service receiving its own unique URL.\u003c/p\u003e\n"],["\u003cp\u003eEach deployment of a service using \u003ccode\u003egcloud app deploy\u003c/code\u003e creates a new version, with traffic automatically directed to the latest version.\u003c/p\u003e\n"],["\u003cp\u003eThe first deployed service on App Engine must be the default service, and if the service name is not specified, it will default to \u003ccode\u003edefault\u003c/code\u003e.\u003c/p\u003e\n"]]],[],null,["# Deploy Your Web Service\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\n**Note:** If you are deploying a new Node.js web service to Google Cloud, we recommend getting started with [Cloud Run](/run/docs/quickstarts/build-and-deploy/deploy-nodejs-service). \n\n### Region ID\n\nThe \u003cvar translate=\"no\"\u003eREGION_ID\u003c/var\u003e is an abbreviated code that Google assigns\nbased on the region you select when you create your app. The code does not\ncorrespond to a country or province, even though some region IDs may appear\nsimilar to commonly used country and province codes. For apps created after\nFebruary 2020, \u003cvar translate=\"no\"\u003eREGION_ID\u003c/var\u003e`.r` is included in\nApp Engine URLs. For existing apps created before this date, the\nregion ID is optional in the URL.\n\nLearn more\n[about region IDs](/appengine/docs/standard/nodejs/how-requests-are-routed#region-id). \nOK\n\nThis section of the guide shows how to use the gcloud CLI to deploy your\nNode.js web service on App Engine. To learn more about\nthe Node.js runtime environment, see [Node.js Runtime Environment](/appengine/docs/standard/nodejs/runtime).\n\nBefore you begin\n----------------\n\n1. [Create a Google Cloud project with an App Engine app](/appengine/docs/standard/nodejs/building-app/creating-project).\n2. [Write a Node.js web server ready to deploy on App Engine](/appengine/docs/standard/nodejs/building-app/writing-web-service).\n3. [Install Google Cloud CLI](/sdk/docs/install), which provides the `gcloud` command-line tool. Ensure `gcloud` is configured to use the Google Cloud project you want to deploy to.\n\nKey points\n----------\n\nUse `gcloud app deploy` and `gcloud app browse` to deploy and view your\nservice.\n\nDeploy your service\n-------------------\n\nIn your `my-nodejs-service` folder, where the `app.yaml` file is\nlocated, run the following command in your terminal: \n\n gcloud app deploy\n\nYour source files are then uploaded to Google Cloud Storage. Cloud Build\nbuilds your app and deploys it to App Engine.\n\nFor information about other ways to build and deploy your app,\nsee [Testing and deploying your app](/appengine/docs/standard/testing-and-deploying-your-app).\n| **Note:** Files listed in your [`.gcloudignore`](/sdk/gcloud/reference/topic/gcloudignore) file will not be uploaded.\n\nIf you don't have one, a `.gcloudignore` file is created to ensure that your\n`node_modules` folder is not uploaded.\n\nNode.js modules are installed in the cloud as listed in your `package.json`\nand `package-lock.json` files and your service is started by using `npm start`.\n| **Important:** For the best performance, your `start` script should be lightweight, because it runs whenever a new instance of your application is created.\n\n### Deploy multiple services\n\nYou can add [multiple services](/appengine/docs/an-overview-of-app-engine#services)\nin your project by creating an `app.yaml` file for each service. Include the\n`service` attribute in each `app.yaml` file to specify the name of the service.\nTo learn more about structuring your app using multiple services, see\n[Structuring Web Services in App Engine](/appengine/docs/standard/configuration-files#directory_structure).\n\nTo deploy multiple services, follow [these instructions](/appengine/docs/standard/testing-and-deploying-your-app#deploying_multiple_services).\nEach deployed service will have its own assigned URL.\n\nView your service\n-----------------\n\nTo quickly launch your browser and access your web service at\n\n`https://`\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e`.`\u003cvar translate=\"no\"\u003e\u003ca href=\"#appengine-urls\" style=\"border-bottom: 1px dotted #999\" class=\"devsite-dialog-button\" data-modal-dialog-id=\"regional_url\" track-type=\"progressiveHelp\" track-name=\"modalHelp\" track-metadata-goal=\"regionalURL\"\u003eREGION_ID\u003c/a\u003e\u003c/var\u003e`.r.appspot.com`, use the following\ncommand: \n\n gcloud app browse\n\nServices and versions\n---------------------\n\nYou've just created and deployed a service on App Engine.\nYou can specify the name of your service in the `app.yaml` file. If the\nname is omitted, it is treated as `default`. The first service you deploy\nmust be the default service.\n\nYou can update your service at any time by running the `gcloud app deploy`\ncommand again. Each time you deploy, a new version is created and traffic\nis automatically routed to the latest version.\n\nTo confirm that your service has been created and a version has been deployed:\n\n1. View your App Engine services in the Google Cloud console:\n\n [View services](https://console.cloud.google.com/appengine/services)\n\n You should see one service listed, named `default`. The default service is\n publicly accessible at the following URL:\n\n\n `https://`\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e`.`\u003cvar translate=\"no\"\u003e\u003ca href=\"#appengine-urls\" style=\"border-bottom: 1px dotted #999\" class=\"devsite-dialog-button\" data-modal-dialog-id=\"regional_url\" track-type=\"progressiveHelp\" track-name=\"modalHelp\" track-metadata-goal=\"regionalURL\"\u003eREGION_ID\u003c/a\u003e\u003c/var\u003e`.r.appspot.com`\n2. View your versions:\n\n [View versions](https://console.cloud.google.com/appengine/versions)\n\n You should see one timestamped version listed, corresponding to your\n deployment.\n\nTo learn how to send requests to specific services and versions, see\n[How Requests are Routed](/appengine/docs/standard/how-requests-are-routed).\n\nNext steps\n----------\n\nNow that you have a Node.js server running on App Engine,\n[learn how to make updates to your web service](/appengine/docs/standard/nodejs/building-app/updating-web-service)."]]