API
API of Serializer and ViewSet in restframework
· ☕ 4 min read
1. Serializer 1.1 Data Validation When deserializing data, the validity of the data needs to be checked. At this point you can call is_valid() for validation, and if a validation error occurs, you can get the error message from the .errors attribute. For example: 1 2 3 4 serializer.is_valid() # False serializer.

ViewSet and Serializer in restframework
· ☕ 6 min read
1. View Class in Django First, recall how Django handles a request. After receiving a request, Django creates a handler of type WSGIHandler, and the handler controls the entire processing flow. So how are the request URL and the View associated with each other? Django first loads the URLconf according to the ROOT_URLCONF setting, then matches the URLpatterns in the URLconf one by one in order, stopping as soon as a match is found.

Using axios in Vue
· ☕ 2 min read
1. Installing axios Install with npm 1 npm install axios --save There are two ways to register it globally: Bind it to the prototype 1 2 import axios from "axios"; Vue.prototype.axios = axios; With this approach, every Vue object gets a new axios object. 1 2 3 this.axios.post(apiUrl).then((res) => {

API Rate Limiting for Backend Services
· ☕ 3 min read
1. Flow Control Caching, degradation, and rate limiting are common methods for protecting high-concurrency systems. Caching trades space for time and cuts the time spent on CPU and network calls; degradation protects the high availability of core services by delaying or refusing to handle non-core requests during peak periods; rate

API Interface Specification
· ☕ 2 min read
In the process of Web application development, backend developers need to deliver API interfaces frequently, and frontend developers need to call API interfaces frequently. To lower communication costs and prevent possible security risks, and following the principle of convention over configuration, it is necessary to standardize the API specification. Restful