Introduction

Tencent Cloud provides developers with a free development environment and production environment, making it easier, faster, and more reliable to build your Mini Program.

NodeJS and PHP are currently supported on the server, and developers can use the developer toolkit for both server and Mini Program development.

Development environment

  • Free to use.
  • Automatically allocate second-level domains for test: xxxxxxx.qcloud.la
  • Automatically deploy HTTPS for free
  • It is only used for on-line debugging and cannot be released.
  • Code deployment, running and database are completely separated from the production environment.
  • Unified with WeChat development tools, it can be used to deploy, debug, restart and restore codes with one click.

Production environment

  • Users need to buy or use the existing Tencent Cloud domain names.
  • Automatically deploy HTTPS for free
  • It is used for on-line release and cannot be debugged.
  • Upload codes with WeChat development tools, operate and deploy in the Tencent Cloud console to separate the upload and release, reducing the risk of incorrect action.

Log in to the Tencent Cloud after authorized by the WeChat Official Account Platform

Open the WeChat Official Account Platform to register and log in the Mini Program, and follow these steps:

  • Click "Settings" in the left menu bar.
  • Click "Developer Toolkit" in the Tab bar on the right.
  • Click "Tencent Cloud" to enter the Tencent Cloud Tools page, and click "Activate".
  • Grant the Mini Program access to the Tencent Cloud by scanning QR code of the WeChat whose ID is bound to the Mini Program. After activation, you will be directed to the WeChat Mini Program console on the Tencent Cloud. When it indicates the state as activated, you can proceed with the operation.

Note: At this time, the Tencent Cloud status viewed via the Mini Program developer toolkit is not shown as activated. The activated status will be synchronized to the WeChat developer toolkit after first deployment of the development environment.

Enter WeChat Official Account Platform backend

Activate Tencent Cloud

Tencent Cloud WeChat Mini Program console

Install development tools

Download and install the latest version of the WeChat Developer Toolkit, scan the QR code with the WeChat whose ID is linked to the Mini Program to log in to the Developer Toolkit.

WeChat Developer Toolkit

Import NodeJS DEMO and configure

  1. Open the WeChat developer toolkit installed in step 2 and click the "Mini Program Project" button.

  2. Enter the AppID for the Mini Program, select an empty directory as the project directory, select "Create Tencent Cloud Node.js Startup Template", and click "OK" to create a Mini Program project.

WeChat Developer Toolkit

  1. Install dependencies

    To facilitate local debugging, it is recommended to install dependencies locally. You can also skip this step and directly install the dependencies online using "Installation Dependencies" under "Tencent Cloud" menu in the developer toolkit.

    Open CMD to install dependencies in the directory you just selected:

    cd server && npm install
    

    Install dependencies

  2. Click the "Tencent Cloud" icon in the upper right of the interface and select "Upload Test Codes" in the drop-down menu bar.

    Upload button

  3. For the first use, it is recommended to select "Module Upload" and check all options. And then check "Automatically Install Dependencies after Deployment" and click "OK" to start code upload. After modifying the server codes later, it is recommended to select intelligent upload. The tool can only be used to upload modified codes.

    Select module

    Successfully uploaded

  4. After uploading the codes, click the "Details" button in the upper right, and select "Tencent Cloud Status" to see the development environment's domain name automatically assigned to you by Tencent Cloud:

    View development domain names

  5. If this is the first time for the current Mini Program to use Tencent Cloud Mini Program service, it needs to completely copy (including https://) the 'request' domain name of the development environment, open the client/config.js file in the editor, fill in the host with the copied domain name and save it. After saving, the editor will automatically compile the Mini Program. The Demo of the client can be displayed on the left emulator window in real time:

    Modify the client configuration

  6. Click "Login" in the emulator. If "Login Successful" is shown, the activation is completed, and then you can start other development.

    Login test

Import the PHP DEMO and configure

  1. Open the WeChat developer toolkit installed in step 2 and click the "Mini Program Project" button.

    tips: It is important to note, if the NodeJS environment is activated for the current Mini Program, you need click the details button in the upper right of the tool, select the Tencent Cloud status, and click to switch languages.

    WeChat Developer Toolkit

    You can choose to switch the language environment in the management backstage of the Tencent Cloud.

    WeChat Developer Toolkit

  2. Enter the AppID for the Mini Program, select an empty directory as the project directory, select "Create Tencent Cloud PHP Startup Template", and click "OK" to create a Mini Program project.

    WeChat Developer Toolkit

  3. Click "OK" again to enter the developer toolkit.

    Developer Toolkit

  4. Click the "Tencent Cloud" icon in the upper right of the interface and select "Upload Test Codes" in the drop-down menu bar.

    Upload button

  5. After uploading the codes, click the "Details" button in the upper right, and select "Tencent Cloud Status" to see the development environment domain name automatically assigned to you by Tencent Cloud.

    View development domain names

  6. Completely copy (including https://) the 'request' domain name of the development environment, open the client/config.js file in the editor, fill in the host with the copied domain name and save it. After saving, the editor will automatically compile the Mini Program. The Demo of the client can be displayed on the left emulator window in real time.

    Modify the client configuration

  7. Click "Login" in the emulator. If "Login Successful" is shown, the activation is completed, and then you can start other development.

    Login test

Other specific development documents

Specific documents about Demo and SDK for the server and client: