title: Posting Jquery Data to Express
body: <p>No matter what combination of req.params/req.query/req.body and $.post({..} I use, I am unable to extract JSON data from my Jquery post request in express. </p>
  
  <p>This is my <strong>jQuery</strong>:  </p>
  
  <pre><code>$.post("/mail", {email : "s@gmail.com", name : "s@gmail.com"});
  </code></pre>
  
  <p>I have also tried various permutations of: </p>
  
  <pre><code>$.ajax({type: "POST", url: "/mail", dataType :"json", data :
  {email : "s@gmail.com", name : "s@gmail.com"}}); 
  </code></pre>
  
  <p>This is my node.js <strong>express</strong> code:</p>
  
  <pre><code>app.post("/mail", function(req, res) {
     console.log(req.body.name);
     console.log(req.route);
     console.log("params1: " + req.param.params);
  ....
  </code></pre>
  
  <p>I have tried endless ways of accessing the data email and name without success. I'd be surprised if the solution were a simple modification to req.body/ req.params but anything is possible! The data just ain't there! (It does not appear in my url either -- all I see is localhost:1337) </p>
  
  <p>req.body / req.params / req.param.params / req.params <em>all  return</em> <strong>undefined</strong> and req.query <em>returns</em> <strong>[]</strong>. </p>
  
  <p>req.route <em>returns</em>:</p>
  
  <pre><code>{ path: '/mail',
    method: 'post',
    callbacks: [ [Function] ],
    keys: [],
    regexp: /^\/mail\/?$/i,
    params: [] }
  </code></pre>
  
  <p>I've tried adding:</p>
  
  <pre><code>app.use(express.bodyParser()); 
  </code></pre>
  
  <p>But, admittedly, I do not fully understand its purpose. Any help is greatly appreciated.</p>
  
  <p>Happy holidays!
  // Sam</p>