Recall & Review
beginner
What is the
req.url property in a Node.js request object?It contains the full URL string of the incoming request, including the path and query string but excluding the domain.
Click to reveal answer
beginner
Explain the purpose of
req.method in a Node.js request object.It shows the HTTP method used by the client, such as GET, POST, PUT, or DELETE, indicating the type of action requested.
Click to reveal answer
beginner
What does
req.headers represent in a Node.js request object?It is an object containing all the HTTP headers sent by the client, like content-type, user-agent, and authorization.
Click to reveal answer
intermediate
How is
req.body used in Node.js request handling?It holds the data sent by the client in the request body, often used with POST or PUT requests to receive form data or JSON.
Click to reveal answer
intermediate
What information does
req.params provide in a Node.js request object?It contains route parameters extracted from the URL path, useful for dynamic routes like '/user/:id' to get the 'id' value.
Click to reveal answer
Which property of the Node.js request object contains the HTTP method used by the client?
✗ Incorrect
req.method holds the HTTP method like GET or POST.
Where would you find the query string parameters in a Node.js request object?
✗ Incorrect
The req.url includes the path and query string.
Which property contains the headers sent by the client?
✗ Incorrect
req.headers is an object with all HTTP headers.
If you want to access data sent in a POST request's body, which property do you use?
✗ Incorrect
req.body holds the data sent in the request body.
How do you access dynamic route parameters like '/user/:id' in Node.js?
✗ Incorrect
req.params contains route parameters extracted from the URL.
Describe the main properties of the Node.js request object and what each one is used for.
Think about what information the server needs from the client request.
You got /5 concepts.
Explain how you would access data sent by a client in the URL path, query string, headers, and body using the request object.
Each part of the request has a specific property in the request object.
You got /4 concepts.