Query strings sit after ? in the URL. Servers use them to filter or paginate. Here: GET posts for one user via ?userId=1. Phase 15 covers building these with URLSearchParams.

URL appears here.

Load posts filtered by userId.

Important JavaScript

const url =
  "https://jsonplaceholder.typicode.com/posts?userId=" + userId;

const response = await fetch(url);
if (!response.ok) {
  throw new Error("HTTP " + response.status);
}
const posts = await response.json();