Framing, Part I

Framing HTTP, REST, APIs, Servers, Promises - I

Imagine you are doing some research on the web. You click on hyperlinks and navigation buttons; you type information into a form and click submit. Suddenly, you get information back, rendered on the screen through HTML and CSS. From an outside perspective, this might feel like magic—but it’s really the result of a sophisticated conversation between your browser (the client) and a server.

In this lesson, we’ll explore what happens behind the scenes from the moment you click on something to when your requested information appears. We’ll use a real-world example—the NASA Image Search—to examine the cause-and-effect chain triggered by each mouse click or keyboard press. By the end of this exploration, you’ll have a deeper understanding of how requests, responses, and server communication shape the internet experience.

Explore

We’ll start by looking at a site with search functionality, to preview many of the concepts you’ll be learning throughout this section: HTTP requests, developer tools, network activity, and more. This exploration is akin to peeking behind the curtain at a theater— you’ll see the “stagehands” (HTTP requests) and “directors” (servers) that make the show (your web experience) run smoothly.

Setup

  1. Navigate to the NASA Image Search page.
  2. Right-click on the page and open the Chrome Developer Tools by choosing “Inspect.” Then click on the “Network” tab in the Dev Tools menu.
  3. Click on the “Clear” icon (⦸) to clear the page. Your DevTools Network tab should look something like this (imagine it as a blank page, ready to log all the behind-the-scenes requests).

Search Terms and Auto-Completion

Clear the network tab, and then type "mars" into the search bar on the NASA search page. Do not click submit and do not press enter yet.

You might notice auto-completion options appear. These suggestions aren't just "magically" appearing; they’re often provided by a server endpoint that your browser is calling behind the scenes. It’s like texting a friend and getting an instant text back with suggestions on what you might want to say next.

Questions to ponder:

Submit the Search Terms

Now, clear the network tab again, and press enter to submit your search for “mars.” You should see a new page load with a list of images related to your search query.

Analogous to a store scenario: You just asked a store clerk (the server) if they carry “mars” postcards, and the clerk gave you a box of postcards that match your request (the images you see). The clerk also labels each postcard with additional data like the location, date, or other relevant information.

Click on a Search Result

Next, clear the network tab once again and click on any image in the search results for “mars.” Observe the activity in the Network tab as the page loads.

You’ll notice additional requests firing off, such as:

Each request is a “conversation” with the server. The “preview” in the Network tab will show you images, while “response” might just show a JSON or HTML structure. The server is handing you each piece of the puzzle, and your browser arranges them to display the page you see.

Try to Explain

Based on your exploration so far, try to draft a rough explanation of what you think happens between typing in a search term and getting a page of images back. You might say something like:

"When I type 'mars' and press enter, my browser sends a request with 'mars' to NASA's server. The server looks up relevant images, then sends back data describing the images. My browser reads that data and uses it to show me thumbnails, titles, and descriptions of images."

You don’t need perfect accuracy yet; simply use your observations to formulate your own mental model. Over time, you’ll refine this as you learn more about HTTP, REST, servers, APIs, and promises.

Looking Ahead

In this section—and in future lessons—you’ll learn about:

Keep coming back to the NASA website or similar search pages as you learn each piece of the puzzle. By the end of this section, you’ll have a pretty detailed understanding of what’s going on behind the scenes each time you press enter or click a button to fetch new information.

Think of each lesson as another clue in a detective story, where the "mystery" is figuring out exactly how your clicks become fully rendered web pages on your screen. With each new concept, you’ll be able to refine your explanation and see more clearly the cause-and-effect chain of events.