当前位置:网站首页>Some thoughts learned recently are attached with answers, and further study and development of knowledge are required in the future.

Some thoughts learned recently are attached with answers, and further study and development of knowledge are required in the future.

2022-06-21 16:04:00 QingHan

One 、 What is the difference between data requested with parameters and data requested without parameters ?

The data you requested , It depends on the interface .

such as :http://127.0.0.1/user/info

user/info This interface determines that it will return user information .

The interface specifies the path and parameters , The requesting party is required to comply with this provision .

The interface specifies that it must carry id Parameters or other parameters , To return data correctly . You add parameters id=123.

The Convention takes parameters , And what format has parameters , Then the server returns the corresponding data according to the interface parameters .

Two 、 Thinking questions

The database is in the hard disk of the server , The data is in the database file . Such as sql Of mdf file . Some sensitive data , You need to test whether the data returned by the interface is consistent with the data in the database .

Here is me and Java Development Manager dialogue :

ask : The data returned by the interface may not be stored in the database , Database is used to store data , It's back to you , But it doesn't help you save the data . The next time you make a request, you will find that the returned data is incorrect . What scene is this ?

Is it my first time to register , Send a request to name and pwd To the server , The server returns the data to the client , The client side has successfully registered . But because the database does not store data , When I log in, I report an error . The request has no response data . That's what I mean ?

answer : There are two types of interface data . Data submitted : It is usually sent to the server for business logic .

Returned data : This is not sure whether it is the data from the database , May be processed .

ask : The interface request parameters must be consistent with the database fields , Otherwise, how do you know whether the returned data is consistent ?

answer : Not necessarily , Generally, to avoid exposing the database structure , It's not the same .

ask : How can the server find the data required by this parameter from the database , How does it judge ?

answer : Transform through interface conventions . Interface agreement :user= user name . The back end got it user , You can turn it into username.

According to the contract , The interface knows the meaning of every data you pass . If you spread more , Non compliant data , Interfaces are also not handled .

ask : The back-end code gets user , You can turn it into username , And then find it in the database username, Return the data of this field to the client through the interface . Is that so? ?

answer : Yes .

When you return, you can put username Change to another name , such as name,adminname.

ask : When requesting, the parameter name is name, In the middle , You should turn back when you return , So still name? Or just turn around ?

answer : Look at the request , It is generally required that the parameter names of the request and response are consistent . Some are more sensitive , Worry about exposing the database field structure , It will be separately modified to :

The request parameter is consistent with the returned parameter name , The database field has another name . Look at the database field name , It is completely invisible that it is related to the request parameter name .

3、 ... and 、 Common sense complements

1. download centos Mirror image :

http://www.downcc.com/soft/504962.html

2.cmder How to switch to the specified directory ?

If it is the default bash, Can directly cd /d/myworkstation

If I use theta cmd Pattern , Can directly :

d:

cd D:\daima\virtualenvs\pythonProject

原网站

版权声明
本文为[QingHan]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/172/202206211535341252.html