title: How can I render content in my Jade template using functions in express?
body: <p>I've got a working user register/login page, the only thing left is making content based on whether the user is logged in or not. After reading I came up with this:</p>
  
  <pre><code>app.use(function(req, res, next) {
    db.users.find({rememberToken: req.cookies.rememberToken}, function(err, foundUser) {
      if (err) { next(); }
  
      if (foundUser[0].length === 0) {
        res.locals.isLoggedIn = false;
        next();
      } else {
        res.locals.isLoggedIn = true;
        next();
      }
    });
  });
  </code></pre>
  
  <p>and then just to test it I did this in my Jade template:</p>
  
  <pre><code>!!!
  html
   head
    #{isLoggedIn()}
  </code></pre>
  
  <p>but all that happens is it says isLoggedIn is not defined.</p>
  
  <p>I can't find much documentation on the subject so any information would be great. Thanks!</p>
  
  <p>I basically want to make the function return true or false so that I can load content based on it.</p>