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

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.

主站蜘蛛池模板: 泾阳县| 八宿县| 辽源市| 和田市| 双牌县| 两当县| 阳泉市| 右玉县| 湖口县| 鄄城县| 虹口区| 土默特左旗| 项城市| 炎陵县| 顺昌县| 瓦房店市| 启东市| 纳雍县| 深泽县| 横山县| 长岛县| 花莲市| 广汉市| 沈阳市| 佛冈县| 大余县| 民勤县| 密云县| 讷河市| 万载县| 萨嘎县| 兰坪| 依兰县| 夏津县| 县级市| 怀柔区| 阳城县| 黄浦区| 化德县| 清河县| 朝阳县|