Web App
The difference between Web App and Web API is that it contains the UI part, and the so-called UI is an HTML page.
Web App supports several ways of rendering HTML:
- server-side rendering
- client rendering
- hybrid rendering
server-side rendering
The server-side rendering UI is when the browser requests, the server generates HTML, and then returns it to the browser.
The advantage is:
- Reduce client stress
- The server generates HTML to adapt to various browsers
- Rarely pull JS code from the client
- Can protect the data and security of the server
- It can protect server resources, including database access, API interface, etc.
- Can be optimized for search engines
weakness is:
- There is a lot of pressure on the server, including CPU and memory
- User interaction needs to generate UI from the server in a circle
Generally used for:
- data read-only website
- Static pages
- management system
Server-side rendering technologies supported by ASP.NET Core 8:
- ASP.NET Core Razor Pages
- ASP.NET Core MVC
ASP.NET Core Razor Pages
Razor Pages is a page-based model that can be used for page-based or Form-based websites.
Advantages of Razor Pages:
- The code of the page is all with the page. Similar to xaml and xaml.cs, here is cshtml and cshtml.cs
- The logic of View is together with View, and the logic is clear.
- It is convenient to group View.
ASP.NET Core MVC
ASP.NET Core MVC uses the MVC architectural pattern, divided into Models, Views and Controllers.
Client requests are sent to Controllers, Controllers process the requests, and then return Views according to Models.
Advantages of MVC:
- Easy to develop large websites
- Clear structure and separation of duties
- loosely coupled
client rendering
Client-side rendering UI is to dynamically render UI on the client side and directly update the browser DOM.
The advantage is:
- It can be exchanged in real time without going around from the server.
- The DOM can be updated incrementally without submitting a request to the server.
- Support offline operation.
- Reduce the pressure and cost on the server side.
weakness is:
- When loading for the first time, you need to download the code to run locally.
Client-side rendering technologies supported by ASP.NET Core 8:
- Blazor WebAssembly
- ASP.NET Core Single Page Application (SPA) with Angular | React | Vue
SPA with Angular | React | Vue
The front and rear ends are separated.
The advantage is:
- The browser provides the runtime environment for JS.
- Good community and ecosystem
weakness is:
- To learn more languages and frameworks