java - How to separate the front-end and back-end to solve the problem of too much back-end data?
PHP中文网
PHP中文网 2017-05-17 09:57:41
0
5
876

Recently I am writing a project that separates the front and back ends. The back end returns json data. Spring mvc provides the function of automatically returning an object to json. However, some data is completely useless to the front end, and it is impossible to re-assemble json by myself. How did everyone solve it

PHP中文网
PHP中文网

认证高级PHP讲师

reply all(5)
黄舟

So why do major manufacturers define front-end not just on the browser side.

The reasonable way is to add a layer of data wrapping on the front end, such as using node.js to convert the secondary interface.

世界只因有你

1. Determine the JSON format of the root server in advance before developing and connecting it
2. Use nodejs to add an intermediate layer to process the data. For example, in some cases, a signature is required and the transfer interface is also required

PHPzhong

In principle, it is best not to support the back-end transmitting too much data to the front-end. If the front-end does not need the data, the back-end will filter it to the front-end

左手右手慢动作

If there are too many useless ones, you may have to spell json by yourself.

仅有的幸福

You can discuss with the backend and conditionally determine which data to return based on the tag parameters passed from the front end. Reduce network data transmission and so on.

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!