LOGBOOK

HELP

1 / 22
Other keys: showSpace: good1-4: rate0: skip5: flag6: invert

Question

How does server-side dynamic content generation work?

Answer

Instead of handing back a pre-written file, the server runs a program for each request and sends that program's output back as the response — so the same address can produce fresh, personalised content every time.

Compare two ways a server can answer a request. A static server keeps a folder of HTML files and ships whichever one matches the URL — the same bytes to everyone, every time. A dynamic server does something fundamentally different: for each incoming request it runs a program, and whatever that program prints becomes the response. That one shift — file lookup replaced by program execution — is what makes logins, search results, and live dashboards possible.

The request makes five hops, frontend to backend and back:

  1. The client (browser) sends an HTTP request, possibly carrying data such as form fields
  2. The web server inspects the request and decides which program should handle it
  3. The server executes that program — written in JavaScript, PHP, Java, C#, or similar
  4. The program produces output: HTML, JSON, a PNG image, plain text — whatever the request calls for
  5. The server wraps that output in an HTTP response and returns it to the client

The key consequence is that one URL is not one fixed page. Because a program runs each time, the same address can answer differently depending on the request parameters, the user's session (who's logged in), the current database state, or even the time of day.

Example: /api/weather?city=Lucerne doesn't read a saved file — it runs a program that looks up Lucerne's current weather and returns fresh JSON. Ask again an hour later and the same URL gives a different answer.

Go deeper:

or press any other key