routes/user.js
/**
 * Provides sidebar data needed for view layout.
 */
Provides sidebar data needed for view layout.
Provides sidebar data needed for view layout .
function handleSidebar(req, res, next, user, cb) {
  Post.findByAuthor(user._id, function (err, posts) {
    if (err) return next(err);
    req.sidebar = {
      viewFile: 'user/_sidebar',
      data: {
        user: user,
        posts: posts
      }
    };
    cb();
  });
}
function handleSidebar ( req , res , next , user , cb ) { Post . findByAuthor ( user . _id , function ( err , posts ) { if ( err ) return next ( err ) ; req . sidebar = { viewFile : 'user/_sidebar' , data : { user : user , posts : posts } } ; cb ( ) ; } ) ; }
Provides sidebar data needed for view layout.
Provides sidebar data needed for view layout .