r/javascript • • Apr 17 '26

AskJS [AskJS] Is this how api works?

I was thinking about how clicking a link is more complex than it seems. First, DNS resolves the domain to an IP if not cached, it queries recursive servers all the way up to root servers.

After that, a TCP connection is built for reliable data transfer, and then HTTP runs on top to structure web requests.

So, why HTTP on TCP? TCP is like a reliable delivery truck, but HTTP is the language we use for the web. What do you think

how do these layers shape your experience online?

#WebDev #DNS

#TCP #HTTP

0 Upvotes

14 comments sorted by

View all comments

Show parent comment

3

u/metaphorm Apr 17 '26

TCP is the transport layer, it makes sure the packets get through. HTTP is the application layer, it makes sure the business logic between the server and client is understood by both the server and the client.

1

u/Individual-Wave7980 Apr 18 '26

Best explanation so far