title: How do you use several request handler in node.js?
body: <p>I come from tornado, where you have a requestHandler class and you match the query to orient it to the right requestHandler.</p>
  
  <p>How do you do in node.js? Something like that ????</p>
  
  <pre><code>http=require ('http');
  url=require('url')
  
  
  function case1(request,response){ ... }
  
  function case2(request,response){ ... }
  
  http.createServer(function(request, response) {
       var q=url.parse(request.url, true).query
       switch(true){
         case /friend/.test(q):
             case1(request,response);
             return;
         case /foes/.test(q):
             case2(request,response);
             return;
       }
  }).listen(9999)
  </code></pre>