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

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.

主站蜘蛛池模板: 易门县| 长武县| 和林格尔县| 吴堡县| 丰城市| 广平县| 唐山市| 开远市| 德兴市| 焉耆| 来宾市| 宁化县| 玛多县| 启东市| 芮城县| 海安县| 汝城县| 靖西县| 太原市| 阿城市| 孝感市| 武鸣县| 深泽县| 台北县| 关岭| 昌邑市| 龙口市| 溧水县| 延吉市| 会泽县| 罗山县| 漯河市| 建平县| 天水市| 周口市| 沽源县| 个旧市| 泰州市| 道真| 万州区| 娱乐|