Saving and listing Category model I have this ExpressJS route for saving and listing Category model.

exports.save = function(req, res, next){
  //validate here&gt;&gt;&gt;
  var name = req.body.name;
  var description = req.body.description;

  new Category({
    name: name,
    description: description,
  }).save(function(err, docs){
    if ( err ) {
      console.log('error: saving category');
      next(error);
    }else{
      console.log('category saved.');
      res.redirect('categories');
    }
  });
}


exports.list = function(req, res, next){
  Category.find(function ( err, categories, count ){
    if (err) {
      console.log('error: listing categories');
      next(error);
    }
    res.render( 'categories/list', {
        categories : categories
    });
  }); 
}


Is having console.log and next(error) OK?  How could I improve the above code in terms of conventions in NodeJS / ExpressJS?
I assume you have a typo there, error is nowhere defined but you do have err.

To jackdbernier's point, you should read the docs:
http://expressjs.com/guide.html#users-online

In there it is clear that you should call next regardless whether you have an error or not, otherwise not all middlewares will be processed.

If you insist on logging before call next, you could.

function handleError( message , err , next )
{
  console.error( message );
  return next( err );
}

new Category({
  name: name,
  description: description,
}).save(function(err, docs){
  if ( err ){
    return handleError( 'error: saving category' , err, next );
  } 
  console.log('category saved.');
  res.redirect('categories');
  next(); // &lt;- this!
});
}


Though I would personally drop the curly braces from that if( err ).