Skip to main content

Quick Start

Leverage CloudBase to rapidly build websites and mini programs, effortlessly achieve multi-end synchronization, and help developers easily embark on their cloud development journey.

Extended Work Mode

When you use this extension:

  1. Cloud functions render web pages.
  2. web pages and mini programs monitor changes in page content input and synchronize.

Prerequisites

CloudBase has been provisioned.

Extension Configuration Information

You can configure the following parameters:

  • Environment ID: Select the environment to deploy to, specifying where it will be used.

Billing

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

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

Created Resources

  • Type: Cloud Function Description: Leverage CloudBase http service capabilities to render web pages, enabling developers to experience CloudBase features.
  • Type: Cloud DB Description: Store user operation data, leverage real-time database capabilities to monitor data changes, and achieve multi-end data synchronization.

Permission Granting

Primary Account

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

Sub-account

If you want a sub-account to be able to use this extension, you need to grant the following permissions to the sub-account:

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

Install Extension

You can install and manage extensions via the CloudBase Console.

Use Extension

  1. Go to the management page of the extension installation environment (replace with custom_env below), open User Management, and navigate to the Login Settings tab:
  • Turn on the [Anonymous Login] switch to allow the application to access CloudBase using anonymous login.

  • In [WEB Security Domains], add the default domain for HTTP-triggered Cloud Functions in the current environment: ${custom_env}.service.tcloudbase.com, allowing CloudBase to be invoked on pages under this domain;

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

    1. Go to [Cloud Database] in the custom_env environment, locate the tcb_hello_world collection and access its details. Navigate to the [Permission Settings] tab, click [Switch to Security Rules], and enter:
{
"read": true,
"write": true
}
  1. web: Access https://${custom_env}.service.tcloudbase.com/tcb_hello_world via browser; 4. WeChat Mini Program: Visit Hello World to get the code snippet, import it into WeChat Developer IDE with one click (do not configure AppID); Update the following configuration in the project's app.js:
const cloud = cloudbase.init({
env: "${custom_env}", // current environment's ID
appSign: "touristappid",
appSecret: {
appAccessKeyId: "Mobile Application Security Sources version", // version obtained in Step 1.3
appAccessKey: "Mobile Application Security Sources Credential" // credential obtained in Step 1.3
}
});
  1. Drag the number in the web or Mini Program, and the same change will be seen on the other end.

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