Recall & Review
beginner
What is the purpose of conditional requests in Express?
Conditional requests help the server decide if it needs to send the full response or just a status like 304 Not Modified, saving bandwidth and improving speed.
Click to reveal answer
beginner
Which HTTP headers are commonly used for conditional requests?
The main headers are
If-None-Match (for ETag) and If-Modified-Since (for last modified date). They tell the server what version the client has.Click to reveal answer
intermediate
How does Express help handle conditional GET requests?
Express provides the
res.sendFile() and res.send() methods that automatically check request headers and send a 304 status if the resource is unchanged.Click to reveal answer
intermediate
What is an ETag and how is it used in Express conditional requests?
An ETag is a unique identifier for a resource version. Express can set ETags automatically, and clients send them back in
If-None-Match headers to check if the resource changed.Click to reveal answer
advanced
How can you manually handle conditional requests in Express?
You can check request headers like
req.headers['if-none-match'] or req.headers['if-modified-since'], compare with your resource state, and respond with res.status(304).end() if unchanged.Click to reveal answer
Which status code indicates the resource has NOT changed in a conditional request?
✗ Incorrect
304 Not Modified tells the client the cached resource is still valid, so no new data is sent.
Which header does the client send to check if the resource's ETag matches?
✗ Incorrect
If-None-Match carries the ETag value from the client to check if the resource changed.
What does Express do when you use res.sendFile() with conditional headers?
✗ Incorrect
Express checks conditional headers and sends 304 Not Modified if the file hasn't changed.
Which header is used to check if a resource has been modified since a certain date?
✗ Incorrect
If-Modified-Since lets the client ask if the resource changed after a specific date.
How can you respond with 304 Not Modified manually in Express?
✗ Incorrect
Use res.status(304).end() to send a 304 status with no body.
Explain how Express handles conditional GET requests using ETag and If-None-Match headers.
Think about how the server knows if the client has the latest version.
You got /5 concepts.
Describe how you would manually implement conditional request handling in an Express route.
Focus on checking headers and deciding the response status.
You got /4 concepts.