May 31, 2021 Article blog
1. Cloud Development (Tencent Cloud Base)
2. Share across account environments
The article comes from the public number: Vue Chinese Community Author: Sexy Superman
Small program cloud development, this wave of updates is available!
Students who do the front end are basically more or less exposed to small programs, but students who have been exposed to small programs are not necessarily exposed to cloud development
Popularize it
Cloud development is a typical way to implement
Serverless
architecture, and there may be students who are unfamiliar with
Serverless
Let's take the word apart again, server less (not important), which can be understood as "serverless"
Imagine that most companies and developers need to think ahead about server, storage, and database requirements when developing applications and deploying services, whether they choose public clouds or self-built data centers, and spend time deploying applications and dependencies. S o is there an architecture that can help us save this part of the cost? Yes, it's our Serverless architecture
Specifically,
Serverless
architecture refers to the maintenance of the back-end infrastructure by third-party service providers, which provides developers with features such as databases, messages, authentication, and so on in a service manner, with the purpose of allowing developers to focus only on the business itself
Now we are back to the small program cloud development itself, cloud development officially encapsulates the cloud function, storage, cloud database capacity, a function call, directly realize the authentication, file upload, update data and other most commonly used functions
In two words, it's true
Let's take a more specific feature
In the traditional mode, we want to call WeChat login, we need to pass code to the service side, the service side will take the code to WeChat service in exchange for user information, self-storage, update
When using cloud development, we just call an
api
and if we're right, it's an
api
and a line of code is finished
Let's take a look at the comparison below
How do you understand that the cloud development of a
small program
has always been an
appid
corresponding to a stand-alone cloud environment?
Or take the actual scenario as an example, such as you have A, B, C three small program products, some of your data may need to be shared, such as user information sharing, commodity information sharing
This small program cloud development before the text is not this ability to deal with, so want to implement either self-built shared data services, or directly deprecate cloud services
Fortunately, it's coming today
Cloud development supports cross-account environment (resource) sharing, i.e. a small program of cloud development resources can be authorized to other applets / public number use
The way to open is also very simple, only need to be in the background of cloud development to the corresponding small program / public number authorization can be, as shown below
Careful classmates may have found out, with a reference to the public number
What? Does the public number also have cloud services?
Yes drop, this update cloud development opened up the public number system, the public number as long as the small program to open authorization, and then the introduction of cloud development
Web sdk
can directly use the small program's cloud services
What's in it for us?
All resources of the cloud development app can be reused on the web side
All the power of a cloud development bug can be reused on the web side (e.g. a cloud function that you've spent two weeks writing about is a bug)
More intuitive feelings, such as the way we signed jssdk before
wx.config({
appId: '公众号 AppID', // 必填,公众号的唯一标识
timestamp: res.timestamp + '', // 必填,生成签名的时间戳
nonceStr: res.nonceStr, // 必填,生成签名的随机串
signature: res.signature,// 必填,签名
jsApiList: ['JS API 名'] // 必填,需要使用的JS接口列表
})
Now we just need that
const res = await cloud.getJSSDKSignature({
url: '要签名的网页 URL'
})
The word is believed to be familiar to everyone
When we want to deploy a static web application, blog, on hand for the time being and no domain name, server, we can host static websites to third-party platforms, such as same-sex dating github
So what's the difference between static site hosting in small program cloud development and others?
It's no different in principle, but as part of WeChat's ecology, WeChat has a natural advantage
Like what:
Small programs Develop static site-hosted domain names in the open cloud without configuring business domain names (only small programs that can use tags)
Non-personal subject of the certification of small programs, using static website hosted pages, you can skip the right to jump arbitrary legal compliance of small programs
Write here, handsome editor suddenly evil smile, is not can use static website hosting to do a WeChat small program application distribution, and then lie down to earn traffic money
Although blowing a wave of cloud development, but still have to give a pertinent advice
Personal projects, simple functions of small programs can try to use, that is real fragrance
Slightly larger and enterprise-class projects are not recommended for full use at this stage and can be mixed on demand
The above is
W3Cschool编程狮
about
the small program cloud development support public number web page development
related to the introduction, I hope to help you.