Programming Interactivity · Lecture 83 h · theory + practice + build
Lecture 8

Over the wire

The Harbour Night Market stops reading its vendors from a file and starts talking to a server. HTTP requests and responses, the event loop and promises (.then and async/await), fetch and the Response object, loading and error states, sending data with POST and handling validation errors, CORS, and responses that arrive out of order. Then 45 minutes building a feature against a real server.

POST /api/stalls/taco-bike/reviews
Content-Type: application/json

{"author":"Ana","rating":5,"text":"…"}

→ HTTP/1.1 201 Created
Location: /api/reviews/r17

Exercises in class order

Each editor has a Network tab next to the console and a server behind it that restarts on every run. Your code is kept as a draft in this browser; ↺ reset goes back to the starting code.

Build the last 45 minutes, individually

Playgrounds

Homework

For the teacher

Slides: → ← move · p presenter view (notes, next slide, lecture clock) · m slide menu · n notes drawer · f fullscreen · t clock in footer · Esc leave an editor.

Serve the repository root over HTTP (e.g. npx live-server): the editors load the API's code from project/server/api-core.js, and the exercises load the race board. Timings, answer keys and the CORS demo script are in run-sheet.md.