title: How does the params hash work in express.js?
body: <p>I don't understand how params works.</p>
  
  <p>I understand it is an object but am not sure how it is works or is formed?</p>
  
  <p>After reading the documentation: <a href="http://expressjs.com/api.html#req.param" rel="nofollow">http://expressjs.com/api.html#req.param</a></p>
  
  <p>Here is an example of code that I am using with the params hash that seems to be working.</p>
  
  <pre><code>function showLoot(req,res) {
    var id = req.params.id;
    console.log(req.params.id);
    console.log(req.params);
    res.setHeader("Content-Type", 'text/html');
    res.send("&lt;html&gt;&lt;head&gt;&lt;title&gt;Adventures - NodeSlash&lt;/title&gt;&lt;/head&gt;&lt;body&gt;&lt;h1&gt;Ogre-slaying knife&lt;/h1&gt;&lt;p&gt;It has +9 against ogres. It was id #" + id + "&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;");
  }
  </code></pre>
  
  <p>Here is the route:</p>
  
  <pre><code>app.get("/loot/:id",       showLoot);
  </code></pre>
  
  <p>What is being console.log from</p>
  
  <pre><code>  console.log(req.params.id); // 1
    console.log(req.params); // [ id: '1' ]
  </code></pre>
  
  <p>if i pass in another id to the url app.get('/loot/:id')</p>
  
  <p>I get (when passing in 5)</p>
  
  <pre><code> console.log(req.params.id; // 5
   console.log(req.params); // [ id: '5' ]
  </code></pre>
  
  <p>I am guessing this an array of objects?
  Where is it stored? 
  Does each request have it's own params object that is magically made?
  Furthermore, how does it take the route number in /loot/:id and place it? Why is the ':' added to :id?</p>