title: How do I display flash message without page refresh using express and connect-flash?
body: <p>Express connect-flash displays only after refresh.  <strong>Code is stripped for easy reading.</strong> </p>
  
  <pre><code>"express": "~4.2.0",
  "connect-flash": "~0.1.1",
  </code></pre>
  
  <p>And here is my <code>app.js</code></p>
  
  <pre><code>var express = require('express'),
      favicon = require('serve-favicon'),
      flash = require('connect-flash');
  var app = express();
  app.use(cookieParser('---'));
  app.use(session({
    secret: '---',
    saveUninitialized: true,
    resave: true}));
  app.use(flash());
  
  app.use(function(req, res, next) {
    res.locals.messages = req.flash();
    next();
  });
  </code></pre>
  
  <p>In my route i tried something like </p>
  
  <pre><code>req.flash('success', {msg: 'Sign Up Success'});
  res.redirect('/me/dashboard');
  </code></pre>
  
  <p>and my error display <code>msg.jade</code> template is </p>
  
  <pre><code>for msg in messages
        div #{msg.msg}
  </code></pre>
  
  <p><strong>I am getting the message only after refresh/redirtect.</strong> Please let me know what i am doing wrong. </p>
  
  <p>I seen <a href="https://stackoverflow.com/q/14803291/827525">this</a> as well but its outdated i think </p>