Cloud Functions

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

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.

Quick Support

image image