one-flash
A flash implementation for Express that goes away after the first navigation.
Usage
npm install one-flash --save
Backend
add it as middleware AFTER session() in your app.js
app;app;
In routes (or any handler)
router; router;
Frontend
(Nunjucks + bootstrap.js 3.x)
{% for message in flash %} × {{ message.message }} {% endfor %}
API
oneFlash adds a property to locals called "flash", its value is an array of "flash" objects.
reslocalsflash = type: 'info' message: 'hello flash' ;
Tests
The entire middleware is very small, and im not sure how to do automated test redirects without a complex Selenium setup. You should know in about two seconds if it doesnt work. Just copy/paste the router samples above and test it.