Data for someone else
After this film you canserve data to a Client Component or outside caller from a Route Handler.
Exercise
Download the exercise (a zip). Unzip it, read exercise.md, then in exercise/ run npm install and node check.mjs. The checker runs a real build and says PASS or FAIL for each criterion.
Recall
Answer each one out loud before you open it.
Who is a Route Handler's answer for?
Another program, like Dave's server. Its response is data, usually JSON, where a page returns HTML for a person.
Why does Dave get Carol's new price straight after she saves?
The Route Handler calls the same cached function, so updateTag('price') refreshes the Route Handler and the page together.
Why doesn't Carol's own page fetch('/api/price')?
A Server Component calls getPrice() directly. Fetching its own Route Handler adds a round trip at request time, and a page prerendered at build time can't do it at all: no server is there to answer.