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

Old and new methods of data flow in SPA

In the traditional flow of serving requests, the order looks like this:

  1. The client requests a web page from the server
  2. The server authenticates and returns a rendered response
  3. Every rendered response is in HTML with embedded data

With SPAs, however, the flow is quite different:

  1. Request the HTML templates with the browser in one single go
  2. Then, query the JSON REST API to fill a model (the data object)
  3. Adjust the UI according to the data in the model (in JSON)
  4. From the browser, push back the changes to the server via an API call

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:

SPAs reduce bandwidth usage and improve site performance. SPAs are a major boost for API-centric server development because now a server can satisfy requirements for both browser and API clients.

主站蜘蛛池模板: 佳木斯市| 嫩江县| 舞钢市| 盖州市| 福清市| 汪清县| 平度市| 新干县| 呼玛县| 和顺县| 扎鲁特旗| 固阳县| 青浦区| 乌兰浩特市| 西峡县| 林州市| 靖宇县| 博野县| 武川县| 五家渠市| 雅安市| 黔东| 英山县| 迁安市| 固安县| 荃湾区| 丹棱县| 宝兴县| 芮城县| 沙坪坝区| 江源县| 禹州市| 察哈| 班玛县| 定南县| 祁连县| 香格里拉县| 安徽省| 崇州市| 扎兰屯市| 文登市|