Backend & Node.js · APIs, data and failure
What happens between a browser sending a request and receiving a response?
Short answer
The client resolves the host, opens a TCP connection, negotiates TLS for HTTPS, sends the HTTP request, and the server routes and processes it. The response returns over the connection, which may be reused for later requests.
The visible request is only one step. Before any HTTP bytes move, the client needs an IP address and a transport connection. Caching can short-circuit the whole process, and connection reuse can skip the handshake on later requests.
The sequence
- Check the browser cache and the service worker for a fresh response
- Resolve the hostname through DNS, using the OS cache and configured resolvers
- Open a TCP connection with a three-way handshake
- Negotiate TLS for HTTPS, including certificate validation and ALPN
- Send the request line, headers and optional body
- The server terminates the connection, routes the request, runs middleware and produces a response
- The client reads the status, headers and body, then may reuse the connection
GET /api/users/42 HTTP/1.1
Host: api.example.com
Accept: application/json
Authorization: Bearer token
Connection: keep-aliveOn the server side, a reverse proxy or load balancer may terminate TLS, add forwarding headers and choose a backend. The application then parses the request, authenticates it, applies business logic, queries dependencies and serializes a response. Latency is usually dominated by the slowest dependency and by database or network waits, not by the framework itself.
Follow-ups you should expect
Interviewers use these to check whether the first answer was understanding or memorisation.
- 1What does a TCP handshake accomplish?
- 2How does connection reuse reduce latency?
- 3What happens when a response is served from cache?
- 4Where would a reverse proxy fit in this flow?
Say it in the interview
The client first resolves DNS and opens a TCP connection, then negotiates TLS if it is HTTPS. It sends the request line, headers and body, and a proxy or the application processes it. The server returns a status, headers and body, and the connection may stay open for reuse. Most of the time is usually spent on handshakes and downstream dependencies rather than the HTTP parsing itself.
Use this as a model, not a script. Saying it in your own words is what makes it survive follow-up pressure.
Related questions
Reading is step one
Now say it out loud.
Understanding an answer and delivering it under pressure are different skills. Rehearse this topic in a live Backend & Node.js mock interview and get scored feedback on depth, clarity and confidence.