liveBook · Manning

Single-page application

As explained in ASP.NET Core in Action, 3e

A single-page application is a web application that updates its user interface dynamically without full-page navigation for most interactions.

A single-page application (SPA) loads its client-side application into the browser and updates the interface dynamically instead of requesting complete HTML pages for most interactions. Frameworks such as Angular, React, and Vue commonly use JavaScript to generate the visible HTML. section 5.1

A typical SPA interaction works in two stages:

  • The browser initially downloads the JavaScript application, which initializes the SPA. section 5.1
  • The initialized application requests data from the server, usually as JSON, then generates the HTML shown to the user. section 5.1
  • The server endpoint providing this data may be called an HTTP API, JSON API, or REST API, depending on its design. section 5.1

Blazor WebAssembly provides a C# and Razor alternative to JavaScript-based SPAs by running in the browser through WebAssembly. Blazor Server offers a related experience by rendering on the server and sending events and updates over WebSockets. section 5.1 section 1.2

Figure 5.2 A sample client-side SPA using Blazor WebAssembly. The initial requests load the SPA files into the browser, and subsequent requests fetch data from a web API, formatted as JSON.
CH05_F02_Lock3

Trace the initial download of SPA files and the subsequent JSON requests to a web API. section 5.1

How ASP.NET Core in Action, 3e covers it

How deep it goes
Describes initialization, JSON communication, and client-side HTML generation without detailing framework internals.
Examples
Uses Angular, React, Vue, Blazor WebAssembly, initial JavaScript files, and JSON responses as examples.
What it assumes
Assumes basic web-browser and server communication concepts while distinguishing SPAs from server-rendered applications.
What you can do after
Evaluate/understand how browser applications load, communicate with servers, and generate updated interfaces.
How it connects
Connects single-page applications with HTTP APIs, JSON, WebAssembly, JavaScript frameworks, and server-rendered applications.

Also explained in

Compare how 5 books explain single-page application →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of ASP.NET Core in Action, 3e. The section links point to the parts of the book it draws on.