search

Home  >  Q&A  >  body text

java - How to separate the front-end and back-end to solve the problem of too much back-end data?

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中文网2775 days ago914

reply all(5)I'll reply

  • 黄舟

    黄舟2017-05-17 09:59:41

    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.

    reply
    0
  • 世界只因有你

    世界只因有你2017-05-17 09:59:41

    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

    reply
    0
  • PHPz

    PHPz2017-05-17 09:59:41

    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

    reply
    0
  • ringa_lee

    ringa_lee2017-05-17 09:59:41

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

    reply
    0
  • 仅有的幸福

    仅有的幸福2017-05-17 09:59:41

    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.

    reply
    0
  • Cancelreply