liveBook · Manning

Server

As explained in Vanilla Web

A networked system that responds to client requests by returning resources or providing services.

For a direct URL such as /products/42, the server responds before the client-side router has started. In a shell-based SPA, it must deliver the entry document for app routes while preserving distinct handling for files, APIs, and missing routes. section 10.2

Choose a deliberate response for each request type:

  • Return the SPA entry document for client-rendered routes; serve real files normally; keep API routes out of HTML rewrites; return a real 404 for unknown routes. section 10.2
  • When deploying under a subpath, align the server rewrite and client router base path. SSR, SSG, and prerendering can instead provide route-specific HTML. section 10.2
Figure 10.2 A link in a shell-based SPA starts on the server, the server delivers the shell (index html) and then the client router in JavaScript is responsible for rendering the view based on the URL.
ch10 F002 firtman

Trace a link from the server’s response with the SPA shell to the client router rendering the matching view. section 10.2

How Vanilla Web covers it

How deep it goes
Defines response rules for app routes, files, APIs, and missing routes, then contrasts SPA rewrites with route-specific HTML.
Examples
Uses /products/42, /assets/app.js, /api/products, and a /dashboard/ deployment path to illustrate routing decisions.
What you can do after
Configure rewrites that serve app routes without intercepting static assets, API endpoints, or unknown paths.
How it connects
Connects server routing with client-side routing, single-page applications, server-side rendering, static site generation, and prerendering.

Also explained in

Compare how 14 books explain server →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Vanilla Web. The section links point to the parts of the book it draws on.