
/*
 * POST /new
 */

exports.new = function(req, res){
  require('crypto').randomBytes(6, function(ex, buf) {
    token = buf.toString('base64').replace(/\//g,'_').replace(/\+/g,'-');
    foodlists = GLOBAL.nano.db.use('foodlists');
    foodlists.insert({ list: token }, token, function(err, body) {
      if (err) {
        console.log('[foodlists.insert] ', err.message);
        return;
      }
      res.redirect(token);
    });
  });
};

/*
 * GET list
 */

exports.show = function(req, res){
  res.render('list', { title: 'My list ' + req.params.list });
};
@@ -261,16 +261,41 @@
 t: token
+, title: req.body.lstitle
  %7D, toke
@@ -315,24 +315,24 @@
 rr, body) %7B%0A
-
       if (er
@@ -513,24 +513,223 @@
 (req, res)%7B%0A
+  foodlists = GLOBAL.nano.db.use('foodlists');%0A  foodlists.get(req.params.list, %7B%7D, function(err, body) %7B%0A    if (err) %7B%0A      console.log('%5Bfoodlists.get%5D ', err.message);%0A      return;%0A    %7D    %0A  
   res.render
@@ -759,30 +759,31 @@
 ist ' + 
-req.params.list
+body.title %7D);%0A 
  %7D);%0A%7D;

set title to user input