From a URL to a response

Clients and servers

See the distinct jobs of an HTTP client and server, and why either side can be implemented with many different tools.

The client starts the exchange. It chooses a URL, builds a request, and sends it.

The server listens for requests. For each one, it decides what should happen and builds a response.

Imagine requesting /articles/hello:

  1. The browser sends a request for that path.
  2. The server matches the path to a route.
  3. The route loads the article.
  4. The server responds with HTML and a status code.

The server does not have to return a file named hello.html. A route can generate the response dynamically.

One program can play both roles. Your application server may receive a browser request, then become a client when it requests data from another API.

Think in terms of each exchange: who starts it is the client; who answers it is the server.

Lesson completed

Take this course offline

Get every free book, course edition, and software download.

Get the download library →