Hello, I’m a confused little K. He is currently a front-end siege lion at iFanR and a member of the know-cloud team.

At the beginning of March, iFanR’s brand – known cloud 3.0 version officially online. This update has received close attention and active support from many developers in the industry. Here, on behalf of the Qiaoyun team, I would like to express my great thanks. ( ̄, ▽ ̄)~*

KnowCloud is the industry’s first back-end cloud service that supports multi-platform small program development. It eliminates the tedious process of server construction, domain name filing, data interface development, online operation and maintenance in small program development, so that developers can make high-quality small programs faster and at a lower cost.

Back to business. Like many children’s shoes, small K use know cloud, is also the first time to develop small programs, the development process is also a hundred twists and turns. Therefore, small K hope through this article, and you children’s shoes to carry on the exchange. After all, the learning experience is similar, and so should the puzzles.

The structure of this paper is as follows:

  • Talk about how to become pay treasure small program developer.
  • Talk about how to create my first Alipay applet.
  • Take a Demo as an example to explain in detail how to access and use the Aware Cloud SDK in Alipay applet.

How to become a small program developer Alipay?

Apply to become a small program developer Alipay, is a very simple thing, only 2 steps, than put the elephant into the refrigerator is simple.

The first step is to log in the Ant Financial open platform and register as a small program development user. This process requires you to complete the process of account information, email activation and information registration.

The second step, after the completion of the above operations, you can enter the small program management background, click to create the application and fill in the information, you can obtain the development of small program AppID after the success of the creation.

Well, now K is a quasi-applet developer. (Please enter the small program configuration – setting – development Settings, configure the interface signing method according to the platform setting method tutorial, and get the Alipay public key and key file)

How do I create my first applet?

After obtaining the “admission qualification”, Xiao K began to refer to the official documentation of small program, download the official developer tools and create an initial small program.

Well done! Little K’s first initialization applet was born ~

Next, you can see Alipay small program official experience small program Demo tutorial documents, familiar with the small program code organization and development features.

Now that you have the development tools and the basics, you can try freestyle.

The only question is: what type of applet should K choose as a Demo?

When it comes to Demo selection, the only rule is simplicity

  • “Jane” is something a white developer like K can read.
  • Being “fine” is about knowing the power of the cloud in as little code as possible.

So I chose the classic TodomVC applet, “My Bookshelf”, as an example.

As the “My Shelf” Demo shows the CRUD operation of data management, one of the core modules of KnowledCloud, well, we hope that through this Demo you can learn to use KnowledCloud to complete the common functions of data addition, deletion, modification and search.

How to call the Know the Cloud SDK in the applet?

  1. The preparatory work

Before officially using the SDK of KnowCloud, make sure to go through the following two processes:

First, complete the authorization of small program. At present, Knowcloud provides small program authorization in both the registration module and the setting module, and the authorization process of the two is basically the same. Here, we demonstrate the setup module small program operation.

Click the app TAB to enter the app management panel.

After entering the management panel, switch to the Settings module and enter the Application Settings TAB page. Click Platform Settings – Alipay applet – immediately open, and click Edit and fill in relevant configuration information to complete the authorization.

Second, in the “small program background” configuration security domain name.

  1. Loading the SDK

Next, take a look at the documentation for the cloud-aware SDK. Old husband pinch refers to a calculation, the SDK access small program method and data table operation to see again, about 10 minutes.

After all, Demo is only about data manipulation, so be sure to focus on what you want to see.

After downloading the SDK provided by the cloud, introduce it into the applet app.js, and get the ClientID of the current application in the TAB page of the applet Settings in the previous setting module.

  1. Design data structures and create data tables

With that done, the little K can use the various interfaces provided by the SDK, and think about what data and structure My Shelf will use.

Since this is the first Demo, in line with the principle of simplicity, little K only designed a bookName field here

Tips: Know that the cloud data management module will automatically create fields such as ID, CREATE_BY, CREATE_AT, UPDATE_AT, and ACL for each data table.

According to the documentation, when using a cloud-aware data management module, you need to first provide the TableName where the data is stored. Therefore, the first step is to get the tableName by creating the data table on the known cloud developer platform.

After retrieving the TableName, Little K places it on the GlobalData object of the app.js file for subsequent parameter calls to various data manipulation interfaces.

Start using the Aware Cloud SDK

Little K won’t go into details about how “My Bookshelf” is written here, because different children’s shoes may have different ways of implementing this feature. Small K will only talk about which controls to use the interface provided by the cloud, to realize the needs of small K — add a book.

  1. Create bibliographic records

It is easy to create a record, just call create to create an empty record, then call set to assign value to the empty record created above, and finally call save to save the record created to the server.

  1. Update a record

Sometimes, the small K hand shake, in the input of the bibliography of the time to fill in the wrong words, so it should provide a function to update records;

Know cloud provides update interface, let update data so easy.

  1. Delete a record

Finally, when a book no longer exists on Little K’s shelf, a delete operation is necessary. A record can be deleted by calling the Delete interface.

The last word

Above is the small K know the cloud cook out of the first Alipay small program – “my bookshelf”, the most important is to use to know the cloud data management function module.

Of course, knowing cloud also provides basic file uploading and data statistics functions as BaaS products, as well as features suitable for small programs, such as Alipay payment and rich text editing functions. *

In addition to the “My Bookshelf” Demo, Knowcloud official also provides Knowcloud SDK official sample applets to demonstrate the use of more abundant interface of SDK. Code is open source on the making of ifanrX, link: https://github.com/ifanrx/hyd… Those who are interested can star or fork.

In this paper, starting from the “unknown cloud” public number: https://mp.weixin.qq.com/s/Vk…

Knowcloud is the first domestic back-end cloud service focusing on small program development. Know the use of cloud, small program development one step faster.