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

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.

主站蜘蛛池模板: 黎平县| 化州市| 太湖县| 兰州市| 措勤县| 苗栗县| 仲巴县| 桂平市| 建始县| 安达市| 五家渠市| 同心县| 定陶县| 兰溪市| 石河子市| 绵竹市| 洪泽县| 冀州市| 郴州市| 广灵县| 兴文县| 大田县| 安陆市| 神池县| 泸定县| 神木县| 利川市| 始兴县| 霸州市| 庄河市| 河池市| 新营市| 太和县| 潮州市| 沿河| 伊春市| 古田县| 亳州市| 九台市| 万荣县| 林周县|