Intro to HTTP

Projected Time

Approximately 2 hours

Prerequisites

Motivation

HTTP is the backbone of the web, for both human users and other programs (APIs)

Specific Things To Learn

Materials

Lesson

Guided Practice

Premade Node Web Server

Node has a library as http.request. It is called http.server.

Build Your Own Web Server

Tutorial to do it yourself:

Now make some requests against it with your browser and also curl. Try logging all the data made available to you in the request object, such as headers.

From the Command Line

Instead of using a browser, let’s see what’s happening underneath.

Questions

Challenge

User Agent is a voluntary header that browsers send identifying themselves.

Extend your Node web server above to console.log which browser the user is uses. Try out mobile browsers to see how they look different.

Check for Understanding

Sync up with your pair or another apprentice who is available and go through the following exercises.

Paper Request

How to know what is required?

If you’re curious what each required piece is, check out this simplified HTTP specification. The complete spec is huge and uses a formal mathematical language if you want to go down a rabbit hole.

Supplemental Materials