title: How to get path variable in express(node.js)
body: <p>I am trying to get value of path variable <strong>"userId"</strong> using <strong>req.params</strong> but i am getting <strong>undefined</strong>, if any one can guide me in this problem i ll be very thankful to him. i have place my code below. 
  i have go through some example but those examples are also doing in this way i don't know what is going wrong with my code.<br>
  thank you,</p>
  
  <p>parent router for controller </p>
  
  <pre><code>app.use("/user/:userId/group",groupController);
  </code></pre>
  
  <p>Action In Controller </p>
  
  <pre><code>Router.post("/", function (req, res, next) {
  
      var group = new Group(req.body);
  
      console.log(req.params);
  
      group.userId = req.params.userId;
  
      group.save(new dataCallbacks(req, res, next, "Group").insert());
  });
  </code></pre>