php - 移动端app后端接口是怎么设计的???做过app后端接口开发可以说下吗?谢谢
滿天的星座
滿天的星座 2017-05-16 13:00:24
0
1
707

移动端app后端接口是怎么设计的???做过app后端接口开发可以说下吗?谢谢

滿天的星座
滿天的星座

reply all(1)
小葫芦

This is a big question. Let’s answer it from several angles.

First, from the perspective of business requirements and performance, it is necessary to clearly define which data structures are placed on the front end, which data structures are placed on the back end, which ones only need to be retrieved once and then cached in the front end, and which ones are cached every time What needs to be communicated with the backend, what needs real-time response, what needs to be pushed, etc. Only after all these are considered clearly and fully communicated with all project team members, and the front-end and back-end developers all agree on this architecture, can we start to consider how to design the back-end.

Second, when starting the backend design, the first thing to consider is the selection of the database. This is another big topic and will not be discussed in detail here. In theory, any language can be equipped with any database, but this is not always the case. It is best to use node.js for Mongodb. Is PHP okay? Of course you can. If the interface is restful, it may be better to choose postgresql than mysql, because it has its own rest interface and does not even need to be developed. But how to ensure security? Does it support jwt? How is the performance? These issues need to be considered carefully. A lot of research and experience beforehand can save a lot of time, don't blindly invest in development.

Third, when both the database and development language are selected, it also depends on whether to use a ready-made framework. Even PHP has at least 10 or more frameworks to choose from. The choice of framework can achieve the effect of getting twice the result with half the effort. At this stage, the front-end and back-end interfaces mainly use json communication, and the soap protocol is rarely used. However, it also depends on whether it is synchronous or asynchronous. Usually asynchronous ajax communication is used, but synchronous communication may also be required, in which case websocket is used. Even if you use json, you have the option of directly defining your own json fields and using the rest method. If you use the rest method, you must consider security issues, because ajax is stateless and there are no sessions and cookies available.

Finally, there is the human factor. The development cycle cannot be infinitely long, and there is no time for everyone to learn. Therefore, it is also necessary to consider which languages, databases and frameworks the team members are familiar with to achieve a balance between system performance and development speed.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!