Cloud Functions

  • date 31st May, 2021 |
  • by Prwatech |
  • 0 Comments

Cloud Functions Quickstart

 

Cloud Functions, a serverless computing solution provided by Google Cloud Platform (GCP), empowers developers to build and deploy lightweight, event-driven applications effortlessly. This introduction will guide you through the quickstart process for setting up and deploying your first Cloud Function, enabling you to kickstart your serverless journey with ease.

To begin, ensure you have a GCP account and have installed the Google Cloud SDK on your local machine. With these prerequisites met, you can proceed to create your first Cloud Function.

Prerequisites

GCP account

Open Console.

Open Menu > Cloud Functions

Click on create function

Give Function name and Region.

Choose the trigger type.

If you need authentication you can tick require authentication.

Then Click Save

The trigger will be created. Click next.

In configuration choose the runtime.

 Give the code. Then press deploy.

The below code is to display ‘Hello World!’.

exports.helloWorld = (req, res) =>

{

            let message = req.query.message  || req.body.message || 'Hello World!';

            res.status(200).send(message);

}

The function will be deployed.

Open the function which we created.

We can test the function which we created. Click testing.

The triggering event will be displayed in here.

Click Test the function button.

It will display the output.

 

This is all about Cloud Functions Quickstart

Quick Support

image image