Router Parameters - Merge Parameters


project link:

Part 3:

I believe there is a typo:
newSpice.spiceRackId equal to the req.params.spiceRackId should say instead:
newSpice.spiceRackId equal to the

Or, I just don’t understand this section very well. It was kind of clunkily written and confusing…

If I understood correctly, this concept is similar to React’s inheritance structure. If that’s true, then taking the app.js info passed from the spiceRack object would requre us to reference the “id” parameter from the request if it’s getting passed into the spicesRouter.js correctly with the {mergedParams: true} setting determined in step 2.


I was not able to get to the correct lesson from your link. I believe you are meaning: Learn Express: Middleware - Router Parameters

Quick answer to your question: No. The req.params.spiceRackId is referring to the spiceRackId on line 73 of app.js app.use('/spice-racks/:spiceRackId/spices', spicesRouter);. The name of the query parameter is spiceRackId, not id. Therefore, in spicesRouter.js would return null.