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

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.

主站蜘蛛池模板: 康平县| 芒康县| 卫辉市| 蚌埠市| 科尔| 嘉善县| 苍山县| 兴仁县| 葫芦岛市| 遂川县| 桃园县| 中山市| 石景山区| 高青县| 甘洛县| 乌苏市| 通渭县| 黄骅市| 武城县| 张家界市| 神木县| 夏河县| 东乌| 长顺县| 黑河市| 九江市| 泰兴市| 河津市| 临湘市| 蛟河市| 达州市| 信阳市| 南京市| 子洲县| 云阳县| 沁阳市| 河北区| 平原县| 玉龙| 讷河市| 锦屏县|