LOGBOOK

HELP

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

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

Question

What is Node.js?

Answer

Node.js is a runtime that lets you execute JavaScript outside the browser — most importantly on a server — so the same language you use for the frontend can also power the backend.

For years JavaScript lived only inside web browsers, with no way to run on its own. Node.js changed that by taking V8 — the fast JavaScript engine from Google Chrome — and packaging it as a standalone program you launch from the command line. The language is exactly the same: a for loop, a function, an array all behave identically. What changes is the environment around the code, and that swap is the whole point.

In the browser, JavaScript talks to the page: document, window, the DOM. None of that exists on a server, so in Node.js those browser APIs are gone. In their place, Node gives your code what a server actually needs:

  • The file system — read and write files on disk
  • The network — open sockets, listen for HTTP requests
  • OS features — environment variables, processes, system info

Two design choices make Node well-suited to servers. It is event-driven with non-blocking I/O, meaning a single thread can juggle thousands of waiting connections instead of stalling on each one (the basis for the event loop covered separately). And because it runs plain JavaScript, the frontend and backend can share one language and even share code.

That versatility shows up everywhere Node is used: web servers and APIs, command-line tools, build tools like Webpack and Vite, and even desktop apps via Electron.

Memory tip: same language, different toolbox — keep your JavaScript knowledge, swap document/window for files, network, and the OS.

Go deeper:

Rocket Turtle, the official mascot of Node.js since February 2024
Rocket Turtle, the official mascot of Node.js since February 2024
OpenJS Foundation · MIT · Wikimedia Commons
or press any other key