First of all, the front-end should impose certain format restrictions on the input content, and make an illegal prompt before submission, and it cannot be submitted; The back-end usually makes a regular HTTP error code. After the front-end and the back-end agree on this error code, the prompt information will be output It is done by the front-end, the front-end and back-end are separated and can be modified flexibly; For example, the back-end returns 200, and the front-end receives 200 and prompts a prompt like XXXXX success
Generally, the front-end does not involve logical judgment and is only responsible for display. Maybe you can return it like this:
{
'status': 'success',
'message': '登录成功'
}
That’s okay.
When I wrote the interface in the past, I returned the relative path of the image. I was also thinking that if the front end spliced the domain name and the relative path, wouldn't it be a complete path? But it will increase the complexity of the front end.
You just have to talk to the two front-end guys about this. It has nothing to do with the boss. What the boss wants is the final result. It’s up to you to decide how to do it. Just communicate with the final standards and what the final standards will be. You can talk to the front-end brothers. Let's talk like this. I will pass the code, status, and data data to you. You only need to judge the code and status. You will return relevant prompts and data data. All successes will be xxx, and failures will be xxx. Otherwise, every interface will transmit Chinese characters. , it’s a pain in the ass for you to judge on the front end.
Maybe your leaders don’t understand technology at all. In principle, the back-end should not transmit server information to the front-end, but it doesn’t matter if it’s just a success or failure prompt. Tell the front-end students about where they went wrong, and they can communicate with you.
If you can do it, just do what the leader says. If you can’t do it, just tell the front-end what the leader says and run away...
First of all, the front-end should impose certain format restrictions on the input content, and make an illegal prompt before submission, and it cannot be submitted;
The back-end usually makes a regular HTTP error code. After the front-end and the back-end agree on this error code, the prompt information will be output It is done by the front-end, the front-end and back-end are separated and can be modified flexibly;
For example, the back-end returns 200, and the front-end receives 200 and prompts a prompt like XXXXX success
Generally, the front-end does not involve logical judgment and is only responsible for display. Maybe you can return it like this:
That’s okay.
When I wrote the interface in the past, I returned the relative path of the image. I was also thinking that if the front end spliced the domain name and the relative path, wouldn't it be a complete path? But it will increase the complexity of the front end.
You just have to talk to the two front-end guys about this. It has nothing to do with the boss. What the boss wants is the final result. It’s up to you to decide how to do it. Just communicate with the final standards and what the final standards will be. You can talk to the front-end brothers. Let's talk like this. I will pass the code, status, and data data to you. You only need to judge the code and status. You will return relevant prompts and data data. All successes will be xxx, and failures will be xxx. Otherwise, every interface will transmit Chinese characters. , it’s a pain in the ass for you to judge on the front end.
I usually return the status code from the interface. Then understand the meaning of the status code in the interface document. That’s ok
Maybe your leaders don’t understand technology at all.
In principle, the back-end should not transmit server information to the front-end, but it doesn’t matter if it’s just a success or failure prompt. Tell the front-end students about where they went wrong, and they can communicate with you.