# Introduction

Tencent Cloud provides free, reliable development and production environments that make it easier for developers to build Mini Programs.

NodeJS and PHP languages are supported at server side. You can set up both the server and Mini Program with the Weixin DevTools.

# Development Environment

  • Free to use;
  • Automatic assignment of secondary domain name for test: xxxxxxx.qcloud.la;
  • Free and automatic deployment of HTTPS;
  • Only used for online debugging and not for publishing;
  • Separates code deployment/running and database from production;
  • Connects to Weixin DevTools to allow quick deployment, debugging, restart and restoration of code.

# Production Environment

  • Users need to purchase Tencent Cloud domain names or use the existing ones;
  • Free and automatic deployment of HTTPS;
  • Only used for online publishing and not for debugging;
  • Uploads code with Weixin DevTools and deploys code with the Tencent Cloud Console. The separation between upload and publishing reduces the risk of misoperation.

# Logging in to Tencent Cloud via Weixin Official Accounts Platform

Open Weixin Official Accounts Platform to register and log in to the Mini Program by following the steps below:

  • Click Settings on the left menu.
  • Click Weixin DevTools tab on the right.
  • Click Tencent Cloud to enter the Tencent Cloud tool page, and then click Activate.
  • Scan the code with the Weixin account bound to the Mini Program to bind the Mini Program to Tencent Cloud. After activation, you'll automatically go to the Tencent Cloud Weixin Mini Program Console and find the development environment has been activated.

Note: At this point, you cannot see the "Enabled" status of Tencent Cloud under the Weixin DevTools. The "Enabled" status is synced to the Weixin DevTools only after the first deployment of the development environment.

进入微信公众平台后台

开通腾讯云

腾讯云微信小程序控制台

# Installing Weixin DevTools

Download and install the latest version of Weixin DevTools, and log in to it by scanning the QR code with the Weixin account bound to the Mini Program.

微信开发者工具

# Importing NodeJS DEMO and Configuration

  1. Open the Weixin DevTools, and then click Mini Program Project.

  2. Enter the Mini Program’s AppID, select an empty directory for the project directory, select Create Tencent Cloud Node.js Launch Template, and then click OK to create a Mini Program project.

微信开发者工具

  1. Install dependencies

    You are recommended to stall dependencies locally to make debugging easier. You can also ignore this step and install dependencies online by selecting Install Dependencies in the Tencent Cloud menu in the DevTools.

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

    cd server && npm install
    

    安装依赖

  2. Click the Tencent Cloud icon on the upper right corner of the page and then select Upload Test Codein the drop-down menu.

    上传按钮

  3. For the first use, select Module Upload and select all the options, and then select Automatically install dependencies after deployment. Click OK to upload the code. After modifying the code for server side, you're recommended to select Intelligent Upload to only upload the modified portion of the code.

    选择模块

    上传成功

  4. After uploading the code, click Details on the upper right corner, and then select Tencent Cloud Status to see the development environment domain name assigned to you:

    查看开发域名

  5. When you use the Tencent Cloud Mini Program service for the first time, you need to copy the development environment's full request domain name (including https://), then open the client/config.js file in an editor to paste the domain name to the host line and save. Then the editor will automatically compile the Mini Program and a client Demo will appear on the simulator window on the left:

    修改客户端配置

  6. Click Login in the simulator. When Login successful appears, the NodeJS environment is enabled and you can start other development tasks.

    登录测试

# Importing PHP DEMO and Configuration

  1. Open the Weixin DevTools, and then click Mini Program Project.

    Note: If the NodeJS environment has been enabled for your Mini Program, click the Details button on the upper right corner, select Tencent Cloud Status, and then click Switch Language.

    微信开发者工具

    You can switch the language in the Tencent Cloud Console

    微信开发者工具

  2. Enter the Mini Program’s AppID, select an empty directory for the project directory, select Create Tencent Cloud PHP Launch Template, and then click OK to create a Mini Program project.

    微信开发者工具

  3. Click OK again to enter the DevTools.

    开发者工具

  4. Click the Tencent Cloud icon on the upper right corner of the page and then select Upload Test Codein the drop-down menu.

    上传按钮

  5. After uploading the code, click Details on the upper right corner, and then select Tencent Cloud Status to see the development environment domain name assigned to you.

    查看开发域名

  6. Copy the development environment's full request domain name (including https://), then open the client/config.js file in an editor to paste the domain name to the host line and save. Then the editor will automatically compile the Mini Program and a client Demo will appear on the simulator window on the left.

    修改客户端配置

  7. Click Login in the simulator. When Login successful appears, the NodeJS environment is enabled and you can start other development tasks.

    登录测试

# Other Development Documents

Documents on server/client Demos, and SDK:

点击咨询小助手