Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to build a server-free back-end system for filtering sensitive words by Serverless

2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

Today, I will talk to you about how Serverless builds a serverless sensitive word filtering back-end system, which may not be well understood by many people. in order to make you understand better, the editor has summarized the following content for you. I hope you can get something according to this article.

Here's how to build a serverless API, a serverless back-end system.

Function workflow

Function Workflow (FunctionGraph,FGS) is an event-driven function managed computing service. Managed functions can be run in a millisecond flexible, maintenance-free and highly reliable way. Through the function workflow, developers do not need to configure and manage the server, but only need to pay attention to the business logic, write the function code, and build the application in a serverless way, then they can develop an elastic and highly available back-end system and charge according to the resources consumed by the actual operation. The efficiency of development and operation and maintenance is greatly improved, and the operation cost is reduced.

Compared with the traditional architecture, the serverless architecture built by functional workflow has the following advantages:

1. There is no need to pay attention to any server, just focus on the core business logic to improve the efficiency of development and operation and maintenance.

two。 The operation of the function is flexible and flexible with the volume of business, and it is paid on demand and billed only after execution. For scenarios where the load peak and trough are very obvious, the cost can be reduced a lot.

3. Through simple configuration, you can connect function workflows and other cloud services, even cloud services and cloud services.

Building a server-free back-end system for filtering sensitive words

In order to further let you feel the advantages of functional workflow, we will introduce how to quickly build a serverless sensitive word filtering system through functional workflow. In this paper, we mainly focus on the back-end system, and the front end can be expressed in many forms. You can build it yourself. As shown in the image below, the system will identify whether the text content uploaded by the user contains sensitive information (such as pornography, politics, etc.) and filter these words.

● imagine, if we develop this application through the traditional mode, how do we need to develop it? Even based on the current cloud platform, we still need to buy a CVM and pay attention to the selection and operation and maintenance of its specifications, images, network and other metrics, and then we may need to consider the integration with other cloud services in the development process, so that a large number of non-business codes are coupled in the code, and resources such as servers are not on demand, especially for scenarios where the peaks and troughs of traffic are very obvious. It will cause a lot of extra expenses.

Now we can quickly build this system through functional workflow services, and do not pay attention to the server at all, and run flexibly and charge on demand.

Create a function, call the text detection API provided by Huawei Cloud content detection service in the function, and configure an APIG trigger for the function to provide an API for sensitive word filtering, thus building a complete serverless backend system for sensitive word filtering. When the client calls API, it automatically triggers the function execution, and the function written by the developer only needs to implement the logic of how to deal with the text after receiving the text, and finally returns the result to the client. At this point, we have built a complete serverless sensitive word filtering back-end system.

Next, we will show you how to build this serverless back-end system completely.

1. Preparatory work

Enter Huawei's cloud content detection service and apply to activate text content detection. After a successful application, you can call the text detection API provided by the content detection service.

two。 Create function

Go to the function workflow service page, create a function, and realize the interface call of text detection and sensitive word filtering.

After the function is created, configure the delegate with IAM access, because the user's ak and sk in the code of this function need to have the permission to access IAM.

3. Create an APIG trigger

Configure an APIG trigger for the function so that you get a HTTP (S) API that calls the function for external calls.

After the creation is successful, the URL of API can be seen in the "trigger" column of the function details page:

4. test

Use tools such as postman to send an post request to the interface of the APIG trigger created in the previous step. The body is: {"msg": "filter detected text"} to view the returned information.

For example, send {"msg": "just fuck..."}, and the return body is {"result": "just..."}

After reading the above, do you have any further understanding of how Serverless builds a serverless sensitive word filtering back-end system? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report