koa-flash
Flash messages for your koa application.
Installation
$ npm install koa-flash
koa-flash also depends on koa-session. You must add koa-session as a middleware prior to adding koa-flash as seen in the example:
Example
var koa = session = flash = ; var app = ; appkeys = 'foo';app;app; app; app;
Semantics
Flash data when set will be saved to the user's session for exactly one more request. You can save any javascript object into this.flash
(Object, Number, String, etc.). A common use case is to save an error message from a POST
request when redirecting to a GET
request to display the form again.
Options
Flash data is saved into this.session['koa-flash']
by default. You can change this by passing in a key
option.
app;
Also, you can set defaultValue
instead of {}
.
app;
License
MIT