Relative Content

Tag Archive for javascriptexpressroutesnestedmiddleware

Why would my parent route in express not pass down the req.params object to its child route?

I’m building an express application that has a users table in its database and a friends table. The point of the friends table is to be a many-to-many table that keeps track of friend requests between users. Since friends are ultimately always going to be tied to users, I wanted my express routes for friends to be a child router to the users router. However, my req.params properties in the parent routes are not being passed down to my friends routes.