This topic describes how to develop a simple serverless Hello World application in the Function Compute console.

Background information

Function Compute provides you with a function template whose output is hello world. You can create a service and a function in the Function Compute console. After the function is created, you can immediately test the function and view the execution details of the function, such as the result, execution summary, and logs.

This topic describes how to create a function from scratch.

Procedure

  1. Create a Service.
    1. Log on to the Function Compute console.
    2. In the left-side navigation pane, click Services & Functions.
    3. In the top navigation bar, select a region.
    4. On the Services page, click Create Service.
    5. In the Create Service panel, configure the Name and Description parameters, and click OK.
      You can also specify whether to enable logging and Tracing Analysis for the service in the Create Service panel. For more information, see Manage microservices.
    After the service is created, you are navigated to the Functions page.
  2. Create a function.
    1. On the Functions page, click Create Function.
    2. On the Create Function page, select Start from Scratch.
    3. In the Basic Settings section, configure the parameters as required and click Create.
      In this example, the parameters are configured in the following way:
      • Optional: Function Name: Enter Function.
      • Runtime Environments: Select Node.js 12 from the drop-down list.
      • Request Type: Select Event Requests.
      • Instance Category: Select Elastic Instance.
      • Memory Capacity: Select 512 MB from the drop-down list.
      • Instance Concurrency: Enter 1.
      • Handler: Enter index.handler.
    After the function is created, you are navigated to the Code tab of the Function Details page.
  3. Invoke the function.
    On the Code tab of the Function Details page, click Test Function.
    Note You can also edit the code in the code editor to implement custom development.
    After the function is executed, you can view the result and detailed logs on the Code tab.