title: What are the 'req' and 'res' parameters in node and node middleware?
body: <p>I'm new to Node and Express and the other layers that go along with building web apps with node and the <code>request</code> and <code>response</code> parameters are really confusing me. My confusion lies in the fact that those two parameters are often present in a function but oftentimes one or both of them isn't declared. Also, much of the time an additional parameter will be thrown in, like <code>'next'</code> or something else. For example, I have the following router for an API:</p>
  
  <pre><code>router.route('/teams')
      // create a team at POST http://localhost:8080/api/teams
      .post(function(req, res) {
          var team = new Team();
          team.name = req.body.name;
          team.location = req.body.location;
  
          // save the new team and check for errors
          team.save(function(err) {
              if (err) {
                  res.send(err);
              };
              res.json({ message: 'Team created!' });
          }); 
      })
      // GET all the teams at GET http://localhost:8080/api/teams
      .get(function(req, res) {
          Team.find(function(err, teams){
              if (err) {
                  res.send(err);
              };
              res.json(teams);
          });
      });
  </code></pre>
  
  <p>Both <code>.post</code> and <code>.get</code>  call a function with <code>req</code> and <code>res</code> as parameters, but <code>req</code> is never used. So how does the function know what to do with req or res if they're not defined and used or not used in completely different orders? Or if I named them something completely different?</p>
  
  <p>What exactly is happening with requests and responses? Sorry for my ignorance. I've read the documentation but it's not clicking.</p>
  
  <p>Thanks.</p>