"Node.js: Hello World" is a simple HTTP-triggered Cloud Functions application that contains a sample Node.js-based script that outputs a sample "Hello World" string.
launch.json
- the required Cloud Code configurationsindex.js
- the Node.js “Hello World” sample’s codepackage.json
- includes the functions framework dependency
-
If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
-
If you're testing this out to learn about the feature, create a new project so that you can delete the project and all associated resources when you're finished.
You can also use this template as a starting point to create a new function in a new or existing project.
-
Make sure that billing is enabled for your Cloud project. Learn how to check if billing is enabled on a project.
-
- Cloud Functions
- Cloud Build
- Artifact Registry
- Cloud Run
- Logging
- Pub/Sub
-
Install Git. Git is required for copying samples to your machine.
-
Install the Cloud Code plugin if you haven't already.
-
Since Cloud Functions integration is currently a pre-release feature, you'll also need to install the pre-release build.
To create a new function using this sample, follow these steps:
-
Click Cloud Code and then expand the Cloud Functions section.
-
Click + Create function and select the Node.js: Hello World template.
-
Navigate to the pathway that you'd like to create your new function in, enter a name for the function, and select Create New Application.
-
If the folder of your application doesn't appear automatically in the Explorer, click Refresh.
To deploy a function, follow these steps:
-
Right-click a function and select Deploy function.
-
In the Quickpick menu, select a GCP project to deploy your function to.
-
Select a region that the function will be deployed to.
-
Select a runtime.
The function's deployment may take a few minutes.
If the deployment fails, refer to the Output tab for the error message. Clicking the link takes you to the build logs in Google Cloud console and provides more detail about the error.
To delete only the function you created for this quickstart:
-
In the Cloud Functions explorer, right-click the function name and then select Open in Cloud Console.
-
Click Delete and then click Delete.
To delete your project and the project's associated resources:
-
Go to the Projects page in the Google Cloud console.
-
Select the project that you created for this quickstart and then click Delete.
-
Type the project ID to confirm and then click Shut down.
This shuts down the project and schedules it for deletion.
We want to hear your feedback!
The Cloud Code team is inviting our user community to sign-up to participate in Google User Experience Research.
If you’re invited to join a study, you may try out a new product or tell us what you think about the products you use every day. At this time, Google is only sending invitations for upcoming remote studies. Once a study is complete, you’ll receive a token of thanks for your participation such as a gift card or some Google swag.
Sign up using this link and answer a few questions about yourself, as this will help our research team match you to studies that are a great fit.