- 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.
推薦閱讀
- 社交網絡對齊
- RCNP實驗指南:構建高級的路由互聯網絡(BARI)
- 物聯網安全(原書第2版)
- 數字烏托邦
- Hands-On Full Stack Development with Spring Boot 2 and React(Second Edition)
- Drush User’s Guide
- 物聯網時代
- 面向云平臺的物聯網多源異構信息融合方法
- 網絡安全技術與解決方案(修訂版)
- NB-IoT物聯網技術解析與案例詳解
- Getting Started with Grunt:The JavaScript Task Runner
- WordPress Web Application Development
- TD-LTE無線網絡規劃與設計
- 紅藍攻防:構建實戰化網絡安全防御體系
- 端到端QoS網絡設計