Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialDarryn Smith
32,043 PointsDon't understand: "The request object stores route parameters in the parameters object."
In the quiz following the video "Requests and the request object" (Express Basics S3V1) there is a true/false problem as follows:
"The request object stores route parameters in the parameters object." The correct response is "false".
However, at approximately 5:50 in the video, Huston states: "The 'title' parameter is going to be the value of the 'title' key in the 'params' object." As I understand it, the 'title' parameter is a component of the route or the routing logic. Later on, we use the console to lookup the parameters object within the request object. In it, we find our 'title' parameter.
So how is the quiz problem false?
Apparently there is a semantic distinction I'm not understanding such that I responded "True" to the quiz problem. Where is the catch, and what am I failing to understand?
1 Answer
jared eiseman
29,023 PointsIf I'm not mistaken the "route parameter" in Huston's example of "app.get('/blog/:title', function (req, res) { ... });" is the ":title" portion. Where as the parameters object is storing the value submitted in the query.
In other words, the route parameter is defined in the route function so that the express app knows how to utilize the extra data being added to the query string, where as the req.params object is where it actually puts the data.
Jasmine Martin
14,307 PointsJasmine Martin
14,307 PointsGreat question