P2B-WEB-2026_2025/block-01/week-01-the_web_under_the_hood/demo/README.md

1.1 KiB

Demo — Inspecting HTTP Traffic

This demo runs a minimal Express server that echoes back everything it receives — method, headers, body. Use it to see what a real HTTP request looks like from the server's perspective.

Setup

npm install
node server.js

Server runs on http://localhost:3000.

What to see

  1. Open http://localhost:3000 in the browser — see the GET request in DevTools Network tab, then see the same info echoed in the terminal
  2. Submit the form at http://localhost:3000/form — see the POST body appearing both in DevTools and in the terminal
  3. Use curl to send a raw request and compare it to what the browser sends:
# Basic GET
curl -v http://localhost:3000

# POST with a body
curl -v -X POST http://localhost:3000/login \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -d "username=user&password=1234"

# See response headers only
curl -I http://localhost:3000
  1. See a Set-Cookie header by visiting http://localhost:3000/set-cookie, then show the cookie being sent back on the next request