Pay attention to learning small program black technology!

At the risk of being blocked, I’m going to tell you about a piece of dark technology that hasn’t been “announced” yet!

Method original research and development, and in the actual project to get a good use experience!

Good! Look down carefully!

I will tell you a very fun, practical, dark technology skill!

This will allow you to expand into more applets and achieve functionality that was never possible before!

Come on!

As you all know, if you want to make a network request to access our WEB back end in an applet, you must do something like the following:

  1. Record your domain name!

  2. Give your back – end service SSL certificate!

  3. To wechat public platform set up small program request domain name whitelist!

  4. Small program call API request access to our back-end data!

This process is not difficult! But for a lot of people, it’s trouble!

So here’s my original method and code to get you out of the first three steps

No record, no HTTPS, no whitelist, directly in the small program to call our API, request any network data!

First, let’s go to the open source address of the V-Request project:

https://github.com/guren-cloud/v-request

(Click star to show your support!)

There will be detailed deployment and use methods, I also briefly introduced here, really very simple! Novice 1 minute!

First we open the developer tools, then open the cloud development function, and after initialization, right click in our cloud functions directory to create a new cloud function:


Call it V-Request (don’t get it wrong, important!)

Then copy and replace the contents of the index.js and package.json files in the project Cloud directory into the corresponding files of the cloud function!

At last! Right click on our new cloud function, upload and deploy (cloud installation dependency)!


Copy the v-request.js file from your project directly into your applet directory. I’ll put it in utils/ :


As a final step, import this file in app.js!


With the simple deployment above, you can now use the wx. vRequest method to make any HTTP network data request anywhere in the applet.

(Note: this is vrequest, which is not the official name of the wx.request method.)

The following tests are performed when the verification domain name and HTTPS Settings are enabled and the request whitelist is not configured in the applet background



Does that sound familiar?

Right! Be consistent with the official Wx. request API! No need to spend too much learning costs!

This method has allowed us to break through the official wechat request whitelist, but in which scenario should we use it more appropriately?

Here are a few of the scenarios you should encounter:

  1. The website domain name has not been recorded

  2. The website is still HTTP 80 port, HTTPS is not enabled and THE SSL certificate is not configured

  3. The site has no domain name and is accessed via AN IP address

  4. Hide the privacy data in access traffic and improve the security of the back end of small programs

If you have the above requirements, might as well try this black technology, solve this pain point problem, improve the efficiency of small program development!

Project address: https://github.com/guren-cloud/v-request

Feel good, welcome to a star!

After the