title: How can I delete flash messages once a page has loaded using express?
body: <p>So I was using express.js under node.js and came across this question. I have a login page where if you get a password/username wrong it will flash a message (Basic stuff using passport). But if you keep trying, the other error messages will stack (Only 1 of each, but they're still there after they're not relevant).</p>
  
  <p>Is there a way i can delete the flash messages once they've been displayed? I'm using <a href="https://github.com/expressjs/flash/" rel="nofollow">this flash</a>.</p>
  
  <p>Here's what I've tried so far:</p>
  
  <pre><code>router.get("/login", function(req, res){
    res.render("login");
    res.locals.flash = [];  
  });
  </code></pre>
  
  <p>and my post req</p>
  
  <pre><code>router.post("/login", passport.authenticate(
    "local",
    {
      successRedirect: "/",
      failureRedirect: "/login",
      failureFlash: true
    }
  ));
  </code></pre>