title: 'TypeError: req.flash is not a function' with app.use(flash()); and still not working
body: <p>The error occrus on my routes.js:</p>
  
  <pre><code>app.get('/login', function(req, res) {
      // render the page and pass in any flash data if it exists
      res.render('login.html', { message:  req.flash('loginMessage') }); 
  });
  </code></pre>
  
  <p>On the <code>req.flash</code> to be more specific.</p>
  
  <pre><code>app.use(logger('dev'));
  app.use(bodyParser.json());
  app.use(bodyParser.urlencoded({ extended: false }));
  app.use(cookieParser());
  app.use(require('less-middleware')(path.join(__dirname, 'public')));
  app.use(express.static(path.join(__dirname, 'public')));
  
  //PASSPORT AUTH
  app.use(flash()); // use connect-flash for flash messages stored in session
  app.use(session({ secret: 'ilovescotchscotchyscotchscotch' })); // session secret
  app.use(passport.initialize());
  app.use(passport.session()); // persistent login sessions
  </code></pre>
  
  <p>As you can see I have <code>app.use(flash())</code>; which was the most common error on the other cases.</p>
  
  <p>Flash is initialized at the beginning as such:</p>
  
  <pre><code>var flash = require('connect-flash');
  </code></pre>
  
  <p>I really don't see where the problem is.</p>
  
  <p>EDIT: ERROR PAGE:</p>
  
  <p><a href="https://i.stack.imgur.com/z59K8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/z59K8.png" alt="error"></a></p>