Recall & Review
beginner
What is an ETag in HTTP?
An ETag (Entity Tag) is a unique identifier assigned by a server to a specific version of a resource. It helps browsers know if the resource has changed since the last time it was fetched.
Click to reveal answer
beginner
How does a conditional request use an ETag?
A client sends the ETag it has in the 'If-None-Match' header. The server compares it with the current ETag. If they match, the server replies with 304 Not Modified, saving bandwidth by not sending the full resource again.
Click to reveal answer
beginner
Which HTTP status code indicates the resource has not changed when using ETag conditional requests?
The status code 304 Not Modified means the resource has not changed and the client can use its cached version.
Click to reveal answer
intermediate
In Node.js, which module is commonly used to handle ETag generation and conditional requests?
The 'http' module can be used directly, but frameworks like Express.js provide middleware (e.g., 'etag' middleware) to automatically generate and check ETags for responses.
Click to reveal answer
beginner
Why are ETags useful for improving web performance?
ETags reduce unnecessary data transfer by letting clients know if their cached copy is still valid. This saves bandwidth and speeds up page loads by avoiding full downloads when content hasn't changed.
Click to reveal answer
What header does a client send to perform a conditional request using an ETag?
✗ Incorrect
The client sends the 'If-None-Match' header with the ETag value to ask the server if the resource has changed.
What does the server respond with if the ETag matches the client's version?
✗ Incorrect
A 304 Not Modified response tells the client to use its cached version because the resource has not changed.
Which Node.js framework commonly helps manage ETags automatically?
✗ Incorrect
Express.js has built-in support and middleware to handle ETags and conditional requests.
What is the main benefit of using ETags in web applications?
✗ Incorrect
ETags help reduce bandwidth by letting clients reuse cached data when the resource hasn't changed.
If a client sends an ETag that does not match the server's current ETag, what happens?
✗ Incorrect
If the ETags don't match, the server sends the full updated resource with a 200 OK status.
Explain how ETags and conditional requests work together to optimize web resource loading.
Think about how your browser checks if a file has changed before downloading it again.
You got /5 concepts.
Describe how you would implement ETag support in a Node.js server using Express.
Express has built-in features to help with ETags and conditional requests.
You got /5 concepts.