tencent cloud

All product documents
Serverless Cloud Function
Last updated: 2024-12-02 16:35:34
Example
Last updated: 2024-12-02 16:35:34
In this tutorial, suppose that:
You want to use SCF to implement a web backend service, such as querying the articles in a blog and providing the article contents.
You want to use APIs to provide services for webpages and applications.

Implementation Overview

The implementation process of the service is as follows:
Create a function, configure API rules in API Gateway, and point the backend service to the function.
A user sends a request that contains an article ID to the API.
SCF queries the content corresponding to the ID according to the request parameters and responds to the request in JSON format.
The user performs subsequent processing after receiving the response in JSON format.
Note: after going through this tutorial, your account will have the following resources:
An SCF function triggered by API Gateway.
An API service in API Gateway and related API rules.
This tutorial is divided into three parts:
Complete the coding, creation, and testing of a function.
Complete the design, creation, and configuration of an API service and API rules.
Test and verify the correctness of the API through a browser or HTTP request tool.

API Design

The design of APIs for modern applications usually follows the RESTful specification. Therefore, in this example, we design the API for getting blog articles as follows:
/article GET Return the article list
/article/{articleId} GET Return the article content based on the article ID
Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback

Contact Us

Contact our sales team or business advisors to help your business.

Technical Support

Open a ticket if you're looking for further assistance. Our Ticket is 7x24 available.

7x24 Phone Support
Hong Kong, China
+852 800 906 020 (Toll Free)
United States
+1 844 606 0804 (Toll Free)
United Kingdom
+44 808 196 4551 (Toll Free)
Canada
+1 888 605 7930 (Toll Free)
Australia
+61 1300 986 386 (Toll Free)
EdgeOne hotline
+852 300 80699
More local hotlines coming soon