title: Routing optional parameters in Adonisjs
body: <p>I have a problem when try to make routing with optional parameters in adonisjs. When i write different endpoint the result of parameter also different</p>
  
  <p>This is my router's code:</p>
  
  <pre><code>Route.post('product/:id_product?', 'ProductController.addProduct')
  </code></pre>
  
  <p>If i send a parameter to this endpoint in postman</p>
  
  <pre><code>http://localhost:3333/shoping/product   //the result of parameter is null
  or
  http://localhost:3333/shoping/product/1    //the result of parameter is 1
  </code></pre>
  
  <p>that parameter can be read in <code>console.log</code>, but if i try to run this endpoint:</p>
  
  <pre><code>http://localhost:3333/shoping/product    //the result of parameter is null
  or
  http://localhost:3333/shoping/product?id_product=1    //the result of parameter also null
  </code></pre>
  
  <p>the result of <code>console.log</code> just <strong>null</strong>. So what's wrong with my route?</p>