title: How can I use a slug with Express and Node.js?
body: <p>How can I go from: <code>http://url:port/user?u=username</code> to <code>http://url:port/user/username</code> when using Express framework on Node server?</p>
  
  <p>Current JavaScript server side code:</p>
  
  <pre><code>  app.get('/user', function(req, res){
      var username = req.param("u");    
      users.findOne({username : username}, function(err, result){      
        var user = {
          username : result.username,
          name : result.name,
          surname : result.surname,
          email : result.email     
        }
  
        res.render('user',
          {user : user}
        );
      })
    })
  </code></pre>