Traditional Culture Encyclopedia - Traditional culture - How to use cloud development for WeChat applet

How to use cloud development for WeChat applet

Cloud development in WeChat applet must be unfamiliar to everyone, because cloud development was launched in September. Compared with before, everyone uses their own servers for database storage. This article mainly introduces how to use cloud development. I read a lot of articles online, and I feel that the introduction is not very detailed. Let's sort out my own thoughts through my personal experience.

First of all, it introduces three main features of the next generation cloud development, and currently provides three basic functions to support it:

Cloud function: the code runs in the cloud, and the WeChat private protocol is naturally authenticated. Developers only need to write their own business logic code.

Database: JSON database that can be operated in front of applet and read and written in cloud function.

Storage: upload/download cloud files directly in the front end of applet, and manage them visually in the cloud development console.

To put it bluntly, the cloud function is the back-end code. Now it's called cloud function. Write it yourself and upload it yourself. There is nothing to say about the database, but this database is a json database, which is very convenient. For example, when we create a database with MySQL, we not only need to write the database name, but also need to design the field type to build the table. Even more painful, we need to write some code to connect to the database. On the contrary, cloud development is easier, you just need to build a collection (so-called table name) in it.

Okay, let's get down to business. Let's talk about the specific steps

1. Open one of our own projects and click on Cloud Development above.

2. Then you need to create a new environment. You can fill in the variables here yourself, as shown below.

3. Once created, we will get the following.

abstract