Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript Express Basics (2015) The Request and Response Objects in Express Review - The Request and Response Objects

Darryn Smith
Darryn Smith
32,043 Points

Don'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
jared eiseman
29,023 Points

If 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.