express-flashy
v0.0.1
Published
Simple flash messages for express 4.
Downloads
4
Readme
flashy
Flashy is an express 4 middleware. It's stupid simple.. just like this README.
Install
$ npm install express-flashy
Usage
var express = require('express');
var session = require('express-session');
var flashy = require('express-flashy');
var app = express();
app.use(session(/** options */));
app.use(flashy());
app.get('/flash', function(req, res) {
req.flashy('info', 'Flash messages made simple!');
res.redirect('/');
});
Then in your views (nunjucks example):
<!DOCTYPE html>
<html lang="en">
<head>
<title>Flashy</title>
</head>
<body>
{{ flashy() | safe }}
<!--
The above would output:
<ul class="flashy">
<li class="flash-info">errors one</li>
</ul>
-->
</body>
</html>
Easy, ya? :surfer:'s up!
License
Copyright (c) 2014 Jordan Stout <http://jrdn.org/>