/toil-backed

Toil BE - cloud function application

Primary LanguageJavaScriptMIT LicenseMIT

Google Cloud Platform logo

Cloud Functions Hello World with Cloud Code

"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.

Table of Contents

Directory contents

  • launch.json - the required Cloud Code configurations
  • index.js - the Node.js “Hello World” sample’s code
  • package.json - includes the functions framework dependency

Getting started with VS Code

Before you begin

  1. 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.

  2. 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.

  3. Make sure that billing is enabled for your Cloud project. Learn how to check if billing is enabled on a project.

  4. Enable the following APIs:

    • Cloud Functions
    • Cloud Build
    • Artifact Registry
    • Cloud Run
    • Logging
    • Pub/Sub
  5. Install Git. Git is required for copying samples to your machine.

  6. Install the Cloud Code plugin if you haven't already.

  7. Since Cloud Functions integration is currently a pre-release feature, you'll also need to install the pre-release build.

Create a function

To create a new function using this sample, follow these steps:

  1. Click Cloud Code icon Cloud Code and then expand the Cloud Functions section.

  2. Click + Create function and select the Node.js: Hello World template.

  3. 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.

  4. If the folder of your application doesn't appear automatically in the Explorer, click VS Code Refresh icon Refresh.

Deploy a function

To deploy a function, follow these steps:

  1. Right-click a function and select Deploy function.

  2. In the Quickpick menu, select a GCP project to deploy your function to.

  3. Select a region that the function will be deployed to.

  4. 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.

Clean up

To delete only the function you created for this quickstart:

  1. In the Cloud Functions explorer, right-click the function name and then select Open in Cloud Console.

  2. Click Delete and then click Delete.

To delete your project and the project's associated resources:

  1. Go to the Projects page in the Google Cloud console.

  2. Select the project that you created for this quickstart and then click Delete.

  3. Type the project ID to confirm and then click Shut down.

    This shuts down the project and schedules it for deletion.

Sign up for user research

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.