
"In this chapter, we'll write our own web server: It will serve files and manage the data for a browser app. Terminology: browser vs. server # The following pairs of opposites are all related: The term "client" is interesting because it is more general than the term "browser" - it refers to any app (web app, mobile app, etc.) that connects to a server. In web development, it usually means "browser" or "web app"."
"Before we can write our first web server, we'll need to learn more about how resources (roughly: files) are served to the web: A browser sends a request to the server. It usually asks for a resource to be served. The server sends back a response - usually, the data for a given resource. HTTP requests and responses are called HTTP messages."
Web servers accept requests from clients (typically browsers) and return HTTP responses containing requested resources or error codes. HTTP messages include a start line, headers, and a body. The start line indicates protocol version and a numeric status code such as 200 or 404. Headers are key-value pairs ending with a colon and include content-type to specify the media type of the response. HTTP/1.1 commonly serves HTML pages as text with headers like last-modified, date, and content-length. Building a server requires handling requests, setting appropriate status codes, and sending correct headers and content.
Read at 2ality
Unable to calculate read time
Collection
[
|
...
]