title: Handling url in express.js+node.js? accepting specific words, double slash and more
body: <p><strong>Homework:</strong><br>
  I know few things about url handling in node.js</p>
  
  <pre><code>app.param('id', /^\d+$/);
  app.get('/user/:id', function(req, res){
      res.send('user ' + req.params.id);
  });
  </code></pre>
  
  <p>Will only accept /user/1, /user/2 ...i.e. with id as integer only</p>
  
  <pre><code>app.get('/:type(discussion|page)/:id', ...)  
  </code></pre>
  
  <p>will only accept type with value of discussion or page</p>
  
  <pre><code>app.param('range', /^(\d+)\-(\d+)?$/);
  app.get('/range/range=:range', function(req, res){
  var range = req.params.range;
      res.send('from ' + range[1] + ' to ' + range[2]);
  });
  </code></pre>
  
  <p>will easily handle integer range and directly give us an array without any split or parsing and validation.</p>
  
  <p><strong>Question :</strong>   </p>
  
  <ol>
  <li><p>Normally server accept www.example.com/path and
  www.example.com//path in same way but in node.js I have to write two
  separate app.get check to do that. How can I achieve this by only
  one check so that /path, //path, ///path gives same response  </p></li>
  <li><p>I have one url which looks for /:path  and path can take values
  listed in a dictionary</p>
  
  <pre><code>var dict={ 
      "a":"You called a", 
      "b": "b is second", 
      "c": "cats are all over internet"
  }
  app.get('/:charc',function(req,res){ 
     res.send(dict[charc]);
  });
  </code></pre>
  
  <p>How can I restrict app to accept only a,b,c without putting an if else condition.
  currently I am doing  </p>
  
  <pre><code>if (typeof dict[charc] == 'undefined') res.send(404, 'Sorry, we cannot find that!');
  </code></pre></li>
  <li><p>Can I call range parameter(from homework part) sameway after '?' like  </p>
  
  <pre><code>app.get('/range?range=:range',...
  </code></pre>
  
  <p>with url www.example.com/range?range=123-234</p></li>
  </ol>