title: Using express-flash with Handlebars?
body: <p>I am following a tutorial that uses ejs5. That tutorial wants me to use express-flash, and organize my <code>routes/users</code> page like so. </p>
  
  <pre><code>router.get('/signup', function(req, res, next){
      res.render('accounts/signup', {
          errors: req.flash('errors')
      });
  });
  </code></pre>
  
  <p>The subsequent es5 goes something like so:</p>
  
  <pre><code>&lt;% if (errors.length &gt; 0) { %&gt;
  &lt;%= errors %&gt;
  &lt;% } %&gt;
  </code></pre>
  
  <p>For myself, I am instead using Express-Handlebars. Now, I know that my <code>app.js</code> file has everything it needs, since my routing to <code>/signup</code> works like so:</p>
  
  <pre><code>router.get('/signup', function(req, res, next){
      res.render('accounts/signup');     
   });
  </code></pre>
  
  <p>However, if I reformat my router code as shown in the first example, I get a 404 error on my <code>signup</code> route. I do not understand why that is. To demonstrate, this is what I have, identical to the first example.</p>
  
  <pre><code>//render the signup//
  router.get('/signup', function(req, res, next){
      res.render('accounts/signup', {
          errors: req.flash('errors')
      });
  });  
  </code></pre>
  
  <p>To be sure, my main app.js file contains the following:</p>
  
  <pre><code>var flash = require('express-flash');
  app.use(flash());
  </code></pre>
  
  <p>In addition to this, I am also unsure how to replicate the ejs script using Handlebars. Would doing something like this work?</p>
  
  <pre><code>{{#if errors.length &gt; 0}}
       {{errors}}
  {{/if}}
  </code></pre>
  
  <p>I am unable to test this as I first need to get my sign up route showing. </p>