The flow of the web apps :
If we open any app or website, the way of displaying the (structure of page or component) content is the same for all users, but only the content differs.
First approach :
-
First, the user sends a request to the server, then the server fetches the data from the database and executes the code on the server and then sends html file to the user.
-
It is fine for small End-users, but if the End-User size keeps on growing, this approach is not good.
Example: If more users hit the server at the same time, then it overburden on the server
Second approach :
- In this approach, the end user sends a request to the server, and then the server sends a response(only data) to the End user.
- On the client side, it receives the data from the server, and then that data is put into a template and executed on the browser.
- This type of application is called a single-page application ( SPA ).
- Advantage: a lot of overburden will be reduced on the server.
Difference between traditional and spa :
Traditional :
- Data filtering is possible, but it is an overburden on the server. If we try to filter the data, then the server filters the data on the server side. After filtering, the server sends the filtered template to the client.
- Data filtering can be done on the server side.
Spa :