P2B-WEB-2026_2025/block-01/week-01-the_web_under_the_hood/demo
2026-06-18 10:21:50 +02:00
..
public Reworked to be in Vite 2026-06-18 10:21:50 +02:00
src Reworked to be in Vite 2026-06-18 10:21:50 +02:00
.gitignore Reworked to be in Vite 2026-06-18 10:21:50 +02:00
delay.html Reworked to be in Vite 2026-06-18 10:21:50 +02:00
form-response.html Reworked to be in Vite 2026-06-18 10:21:50 +02:00
form.html Reworked to be in Vite 2026-06-18 10:21:50 +02:00
index.html Reworked to be in Vite 2026-06-18 10:21:50 +02:00
package.json Reworked to be in Vite 2026-06-18 10:21:50 +02:00
pnpm-lock.yaml Reworked to be in Vite 2026-06-18 10:21:50 +02:00
pnpm-workspace.yaml Block 01, Week 01 added 2026-05-25 16:27:37 +02:00
README.md Block 01, Week 01 added 2026-05-25 16:27:37 +02:00
server.ts Reworked to be in Vite 2026-06-18 10:21:50 +02:00
set-cookie.html Reworked to be in Vite 2026-06-18 10:21:50 +02:00
show-cookie.html Reworked to be in Vite 2026-06-18 10:21:50 +02:00
status-code.html Reworked to be in Vite 2026-06-18 10:21:50 +02:00
status.html Reworked to be in Vite 2026-06-18 10:21:50 +02:00
tsconfig.json Reworked to be in Vite 2026-06-18 10:21:50 +02:00
vite.config.ts Reworked to be in Vite 2026-06-18 10:21:50 +02:00

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