官术网_书友最值得收藏!

Old and new ways of data flow in SPA

All websites go through the following steps:

  1. Request a web page from the server.
  2. Authenticate and show the Dashboard UI.
  3. Allow the user to modify and save.
  4. Request as many web pages from the server as needed to show inpidual pages on the site.

But in the SPA, the flow is quite different:

  1. Request the HTML template/s to the browser in one single go.
  2. Then, query the JSON REST API to fill a model (data object).
  3. Adjust the UI according to the data in the model (JSON).
  4. When users modify the UI, the model (data object) should change automatically. For example, in AngularJS, it is possible with two-way data binding. Finally, make REST API calls to notify the server about changes whenever you want.

In this way, communication happens only in the form of the REST API. The client takes care of logically representing the data. This causes systems to move from Response Oriented Architecture (ROA) to Service Oriented Architecture (SOA). Take a look at the following diagram:

 

SPA reduces the bandwidth and improves the site performance.

主站蜘蛛池模板: 新兴县| 宁远县| 济宁市| 黄浦区| 安国市| 英山县| 福安市| 库伦旗| 临武县| 通州区| 隆子县| 大田县| 彭阳县| 桐城市| 虞城县| 乐昌市| 昌图县| 临武县| 越西县| 宣武区| 寿阳县| 勃利县| 阜宁县| 安丘市| 宜兴市| 晋州市| 樟树市| 余江县| 徐汇区| 彭阳县| 郸城县| 赣州市| 新平| 盘山县| 平定县| 兴义市| 武夷山市| 涞水县| 富源县| 沛县| 金昌市|