HTTP protocol request response model

HTTP protocol request-response model: The "user login" to describe the scene

Step one: The client initiates a request to the API interface layer actions: fill in the user name and password in the client, click on the login request is sent.

Step two: api receiving a user request initiated by the client, api business logic validation, which verifies that the user name and password are legitimate, such as: user name requirements must be real phone number (No. 1, beginning 1, two, 34578) If the authentication fails, the user name that is not legitimate, then the time required to the client returns the response code. This response is a custom code, such code represents the user name is 1,2,3,1 malformed, represents user name or password is incorrect, an error format represents password (Note that these may be verified at the front end verification). If the validation is successful, the data will be entered by the user api sent to the db layer, a database will do create, read, update, delete operation (no matter how complex business logic, database level to do this four operations) database query successfully returns 1 failed to return 0.

The third step: the number of entries DB database query will return to the api (in this login scenario, the database returns a 1 or 0, because the user name is not the same name, if the query is successful, the number of qualifying are 1, the query fails, it returns 0).

Step four: api returns a success or failure status code to the client.

Step five: Client information is returned to the user.

 

Guess you like

Origin www.cnblogs.com/zhouamin/p/11470620.html