Recall & Review
beginner Click to reveal answer
What is the
res object in Express?The
res object represents the HTTP response that an Express app sends when it gets a request. It helps you control what the user sees or receives.beginner Click to reveal answer
Why do we use
res.send() in Express?res.send() sends a response back to the client. It can send text, HTML, or JSON. Without it, the client waits and gets no answer.intermediate Click to reveal answer
How does
res.status() help in Express?res.status() sets the HTTP status code of the response, like 200 for success or 404 for not found. It tells the client what happened with the request.intermediate Click to reveal answer
What happens if you forget to use
res.end() or res.send() in Express?The client will keep waiting because the server never finishes the response. This can cause the app to hang or timeout.
beginner Click to reveal answer
How does understanding
res improve your Express app?Knowing how to use
res lets you control what the user sees, handle errors clearly, and make your app faster and friendlier.What does
res.json() do in Express?✗ Incorrect
res.json() sends a JSON-formatted response to the client.Which method sets the HTTP status code in Express?
✗ Incorrect
res.status() sets the HTTP status code for the response.What happens if you don't send a response using
res methods?✗ Incorrect
Without sending a response, the client keeps waiting and may timeout.
Which
res method is used to send plain text or HTML?✗ Incorrect
res.send() sends plain text or HTML responses.Why is controlling
res important in Express?✗ Incorrect
Controlling
res lets you decide what the client gets and how errors appear.Explain why the
res object is important in Express and how it affects the client experience.Think about what happens if the server never sends a reply.
You got /4 concepts.
Describe how you would use
res.status() and res.send() together in an Express route.Consider telling the client if something went wrong.
You got /4 concepts.
