A web application is a chain of contracts. A browser resolves a URL, sends a request, receives a response, parses markup, applies styles, and runs only the scripts needed for interaction. The server may read or change data, but it must decide what the caller is allowed to do. If one layer silently assumes another layer has validated input, the application can appear correct in a demo and fail under a direct request. Start with a case record that exists as HTML before enhancement runs. Draw the GET request and identify its path, status, content type, and body. Then add a form for an inspection note and follow its POST through parsing, validation, authorization, storage, and response. Test the same page with scripts disabled and with an unavailable API. A visible failure state is part of the contract, not polish added after the happy path.
Web Development: follow one request through the stack
Working contract
const caseTarget = new URL("/cases/47", window.location.origin);
const response = await fetch(caseTarget);
if (!response.ok) throw new Error(`Case read failed: ${response.status}`);
const caseRecord = await response.json();
document.querySelector("#case-title").textContent = caseRecord.title;Cost and tradeoffs
This one read spends O(B) time and memory decoding a response of B bytes. The page should still include essential case text in its initial HTML; this fetch can refresh details, but cannot be the sole route to understanding the record.
Common Mistakes
- Do not assume a browser check is a server rule.
- Do not judge the full page by its response status alone.
- Do not hide a failed operation without a visible recovery path.
Continue
HTTP requests: keep method, status, and body contracts separate; Page loading: keep content available while CSS and scripts arrive; HTML Tutorial; CSS Tutorial; JavaScript Tutorial.
First route drill
Open case 47 by typing its path into a fresh tab. Record the method, status, content type, and first meaningful text returned before scripts run. Disconnect the API and reload. If the page becomes empty, the first response carries too little information. Next submit an inspection note through the native form and record which layer validates it, which layer authorizes the reviewer, and which response confirms storage. This trace establishes the baseline before adding faster client behavior.
Verification
- Read the case with scripts disabled and confirm the title and navigation remain.
- Submit a blank note and confirm the server does not create a record.
- Interrupt a valid submission and distinguish an unknown outcome from a confirmed rejection.
Apply next
Build Practice project: trace a case page across the stack and check the boundaries in Web Development: browser contracts quiz.
