Serverless + cloud database to easily create a backend (1) ---use Tencent Cloud SCF as an interface (query database)

I recently tried using Tencent Cloud SCF and
slowly fell in love with Tencent Cloud (a bunch of things)

Open Tencent Cloud SCF console

Insert picture description here
Or here
Insert picture description here
Insert picture description here

Create cloud function

Insert picture description here
There are many templates here.
Choose a language you use to develop.
Here I chose Nodejs. After all, I checked a bunch of information with PHP to solve the problem.

Insert picture description here

Configure trigger

Here is only configured if you need to go to the API gateway to enable cross-domain testing
Insert picture description here

Complete creation

There is a demand to open private network did not open demand
Insert picture description here
can be completed

Configure cross-domain

Insert picture description here
Edit,
Insert picture description here
you can see that OAuth2.0 is also supported here. OAuth2.0
is particularly used in authentication resource management, etc.

Insert picture description here
Supporting CORS is to open cross-domain

Modify the code to connect to the database

If you have a cloud database, fill in the cloud database information here
Insert picture description here
Insert picture description here

test

Find the access path copy in the trigger management because it is a GET request, you can test it directly in the browser and
Insert picture description herepaste it into the browser and press Enter
Insert picture description here

Insert picture description here

Hehe it's done here

benefit

Reduce back-end development costs and allow individual developers to pay more attention to their own page design

We will mount the team website later







  Hello everyone, I am a code husky, a student of network engineering in the Software College, because I am a "dog", and I can eat meat for thousands of miles. I want to share what I learned during university and make progress with everyone. However, due to the limited level, there will inevitably be some mistakes in the blog. If there are any omissions, please let me know! For the time being, only update on the csdn platform, the blog homepage: https://blog.csdn.net/qq_42027681 .

未经本人允许,禁止转载

Insert picture description here


Will be launched later

Front-end: vue entry vue development applet, etc.
Back-end: java entry springboot entry, etc.
Server: MySQL entry server simple instructions cloud server to run the project
python: recommended not to warm up, be sure to see
the use of some plug-ins, etc.

The way of university is also in oneself, study hard, youth
with passion. If you are interested in programming, you can join our qq group to communicate together: 974178910
Insert picture description here

If you have any questions, you can leave a message below, I will reply if you see it

Guess you like

Origin blog.csdn.net/qq_42027681/article/details/112383634