- Building RESTful Web services with Go
- Naren Yellavula
- 187字
- 2021-07-02 20:14:04
Old and new ways of data flow in SPA
All websites go through the following steps:
- Request a web page from the server.
- Authenticate and show the Dashboard UI.
- Allow the user to modify and save.
- 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:
- Request the HTML template/s to the browser in one single go.
- Then, query the JSON REST API to fill a model (data object).
- Adjust the UI according to the data in the model (JSON).
- 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.
推薦閱讀
- FreeSWITCH 1.2
- 解析QUIC/HTTP3:未來互聯網的基石
- Cisco OSPF命令與配置手冊
- Hands-On Industrial Internet of Things
- Django 2 by Example
- 走進物聯網
- Proxmox High Availability
- Building RESTful Web Services with Spring 5(Second Edition)
- Practical Web Design
- 物聯網之霧:基于霧計算的智能硬件快速反應與安全控制
- Echo Quick Start Guide
- Learning Windows 8 Game Development
- 大型企業微服務架構實踐與運營
- 中國互聯網發展報告2021
- LwIP應用開發實戰指南:基于STM32