Home  >  Q&A  >  body text

javascript - Should the data display on the front-end page be directly output by the background, or should an API interface be provided for the front-end to call?

Does the background staff directly output the data on the page or provide an API interface to the front end, and then display it on the page similar to an ajax request?
If you use an api interface, you are afraid that the API interface link will be stolen by others. Is there any way to prevent it? ?

阿神阿神2702 days ago790

reply all(4)I'll reply

  • 滿天的星座

    滿天的星座2017-05-27 17:42:32

    It depends on what kind of customers you have. If your background data belongs to a database class used to save customer information, you can try to use the ajax header to verify the other party's information. For details, you can learn about APIclound's documentation. When they call the interface, they use the header to verify the appid and appkey

    reply
    0
  • 某草草

    某草草2017-05-27 17:42:32

    The former is suitable for close integration of PHP and views, while the latter is suitable for interface service operations. The specific choice depends on the actual situation of your project. If you use an interface, you can set sign signature verification and token login verification for your interface

    reply
    0
  • 淡淡烟草味

    淡淡烟草味2017-05-27 17:42:32

    You can verify permissions on both interfaces and pages. For example, you need to log in to view it, and you can only view it if you have a corresponding level. These can be placed in the session.

    reply
    0
  • 黄舟

    黄舟2017-05-27 17:42:32

    If you directly output the page, it will also be crawled away. It is better to find ways to strengthen user verification and check before entering sensitive pages. The backend needs to have an anti-crawling mechanism. Even legitimate users who obtain a large amount of data in a short period of time must be automatically blocked and Adamin notified.

    reply
    0
  • Cancelreply