Skip to main content

Quick Start

Cloud Development enables quick building of web websites and Mini Programs, easily achieving multi-end synchronization and helping developers easily enable their cloud development journey.

Scale-out work mode

When you use this scale-out extension:

  1. Cloud Function renders web pages.
  2. web pages and Mini Programs listen for changes in page content input and synchronize.

Prerequisites

Have activated Cloud Development.

Scale-out Configuration

You can use the following configuration parameters:

  • Environment ID: Select the environment to deploy in.

Billing

This extension uses other Cloud Development or other Tencent Cloud services, which may incur relevant fees:

When using Cloud Development extensions, you pay only for the cloud resources you consume; Cloud Development is billed separately from other cloud resources. You can view details in the Billing Center.

Created Resources

  • Type: Cloud Function Description: Utilizes the Cloud Development http service capability to render web pages, enabling developers to experience Cloud Development capabilities.
  • Type: Cloud DB Description: Stores user operation data, utilizes the real-time database capability to monitor data changes, and achieves multi-end data synchronization.

Permission Granting

Master Account

This extension capability can be accomplished using Cloud Development's own resources alone, and no additional permissions need to be granted.

Sub-account

If you want sub-accounts to also use this extension, you need to grant the following permissions to the sub-accounts:

  • Policy: QcloudTCBFullAccess Description: Full read-write access permissions for CloudBase.

Install Extension

You can install and manage extensions via the Tencent Cloud Development Console.

Use Extension

  1. Go to the management page of the extension installation environment (hereinafter referred to as custom_env), open User Management, and navigate to the Login Settings tab page.
  • Turn on the [Anonymous Login] switch to allow anonymous login access to Cloud Development in the application; Add the default domain name for HTTP-triggered cloud functions in the current environment: ${custom_env}.service.tcloudbase.com in [WEB Security Domains], to allow invoking web Cloud Development on pages under this domain;

  • Register touristappid in [Mobile Application Security Sources], and after successful addition, obtain credential information for later use;

    1. Open the [Database] under the custom_env environment, find the tcb_hello_world collection and go to its details. Go to the [Permission Settings] tab, click [Switch to Security Rules], and enter:
{
"read": true,
"write": true
}
  1. web website: Access https://${custom_env}.service.tcloudbase.com/tcb_hello_world via a browser; 4. WeChat Mini Program: Visit Hello World to obtain the code snippet, one-click import the code into the WeChat Developer IDE (do not configure AppID); In the project app.js, update the configuration as follows:
const cloud = cloudbase.init({
env: env: "${custom_env}", // The ID of the current environment
appSign: "touristappid",
appSecret: {
appAccessKeyId: appAccessKeyId: "Mobile Application Security Sources version", // version obtained in step 1.3
appAccessKey: appAccessKey: "Mobile Application Security Sources credentials" // credentials obtained in step 1.3
}
});
  1. Drag the number in the web or Mini Program to observe the same change on the other end.

! This extension is a sample Demo. Please follow the usage instructions to complete the configuration. When registering security sources, use touristappid to register; when experiencing it in the Mini Program, there is no need to configure AppID—simply enter the version and credential information corresponding to touristappid.