title: how to make required and optional date params in express?
body: <p>I am having difficulty making a route like this as I am new in express routing:</p>
  
  <blockquote>
    <p>GET users's exercise log: GET
    /api/exercise/log?{userId}[&amp;from][&amp;to][&amp;limit]</p>
    
    <p>{ } = required, [ ] = optional</p>
    
    <p>from, to = dates (yyyy-mm-dd); limit = number
    I don't understand what's that ? and &amp; on the route for? what i see on youtube are routes like this:</p>
  </blockquote>
  
  <pre><code>app.route('/api/exercise/log/:userId').post(exercisehandler);
  </code></pre>
  
  <p>I want to make a route like this:</p>
  
  <pre><code>GET /api/exercise/log?userId=1234&amp;from=2018-01-01&amp;to=2018-07-23&amp;limit=100
  </code></pre>
  
  <p>I am looking on the routing doc on <a href="https://expressjs.com/en/guide/routing.html" rel="nofollow noreferrer">express</a> but I still want to get an idea here so i can get this done quicker. help?</p>