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

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.

主站蜘蛛池模板: 彝良县| 金华市| 加查县| 峨边| 霸州市| 湘西| 焦作市| 怀仁县| 武乡县| 永川市| 宁安市| 广平县| 蒙阴县| 花莲县| 三原县| 湛江市| 陵川县| 泌阳县| 城步| 抚远县| 海南省| 潞城市| 天峨县| 油尖旺区| 岑溪市| 什邡市| 高陵县| 邯郸县| 酉阳| 西和县| 广昌县| 梧州市| 武平县| 阿拉善盟| 镇江市| 山阴县| 富蕴县| 民丰县| 仲巴县| 象州县| 抚宁县|