title: Having a hard time trying to understand 'next/next()' in express.js
body: <p>This is an example of it:</p>
  
  <pre><code>// Configuration
  app.configure(function(){
    app.set('views', __dirname + '/views');
    app.set('view engine', 'jade');
    app.use(express.bodyParser());
    app.use(express.methodOverride());
    app.use(app.router);
    app.use(express.static(__dirname + '/public'));
  });
  </code></pre>
  
  <p>(etc.)</p>
  
  <pre><code>app.get('/memo', function(req, res) {
    console.log("index");
    Memo.find({}, function(err, data) {
      if(err) return next(err);
      res.render('index', { memos: data });
    });
  });
  </code></pre>
  
  <p>And here is another one:</p>
  
  <pre><code>app.get('/memo/list', function(req, res, next) {
    console.log("get memos");
    Memo.find({}, function(err, data) {
      if(err) return next(err);
      res.json(data);
    });
  });
  </code></pre>
  
  <p>Taken from a <a href="https://github.com/muraken720/node-crud" rel="noreferrer">simple memo pad built on node</a></p>
  
  <p>These are the questions that are puzzling me:</p>
  
  <ol>
  <li>What does exactly <code>next/next();</code> do? What would happen if it is not present? </li>
  <li>Why is the second part taking <code>next</code> as a parameter and the first isn't?</li>
  </ol>
  
  <p>EDIT:</p>