Flash messages

An easy way to display messages after a redirect is to add the express-flash middleware.

This will enable the req.flash variable in ExpressJS route handlers.

Add a flash message like this:

app.get('/the-route', function (req, res) {
    req.flash('info', 'Flash Message Added');
    res.redirect('/');
});

This will add a variable on can use in handlebars templates like this:

<div class="entry">
    <h1> {{messages.info}}</h1>
</div>