- 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.
推薦閱讀
- Cisco OSPF命令與配置手冊(cè)
- 面向物聯(lián)網(wǎng)的CC2530與傳感器應(yīng)用開發(fā)
- 物聯(lián)網(wǎng)安全:理論、實(shí)踐與創(chuàng)新
- 數(shù)字烏托邦
- 物聯(lián)網(wǎng)安全與深度學(xué)習(xí)技術(shù)
- NB-IoT物聯(lián)網(wǎng)技術(shù)解析與案例詳解
- 中小型局域網(wǎng)組建、管理與維護(hù)實(shí)戰(zhàn)
- 區(qū)塊鏈輕松上手:原理、源碼、搭建與應(yīng)用
- 計(jì)算機(jī)網(wǎng)絡(luò)技術(shù)及應(yīng)用
- 網(wǎng)絡(luò)工程實(shí)施技術(shù)與方案大全
- bash網(wǎng)絡(luò)安全運(yùn)維
- Getting Started with tmux
- Hands-On Docker for Microservices with Python
- RestKit for iOS
- SEO攻略:搜索引擎優(yōu)化策略與實(shí)戰(zhàn)案例詳解