title: How can I get react-router v4 defined params with express at server-side
body: <p>I try to get the <code>:userId</code> "albert" from this url 
  <code>http://localhost:5000/search/albert?query=al&amp;page=1</code>
  at server side but failed, what can I do to get the react-router defined params correctly at node.js with express?</p>
  
  <p>routes.js</p>
  
  <pre><code>[
    {
      path: '/search/:userId',
      component: Search,
    }, {
      path: '/search',
      component: Search,
    }
    ... 
  ]
  </code></pre>
  
  <p>server.js</p>
  
  <pre><code>server.get('*', async (req, res, next) =&gt; {
    const pageData = await routes
    .filter(route =&gt; matchPath(req.path, route))
    .map((route) =&gt; {
      console.log(route)
      return route.component
    })
  }
  </code></pre>