Skip to content

d-band/koa-flash2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#koa-flash2

Greenkeeper badge

Flash messages for koa based on connect-flash.

Build Status Coverage Status

Installation

$ npm install koa-flash2

koa-flash2 also depends on koa-session. You must add koa-session as a middleware prior to adding koa-flash2 as seen in the example:

Example

var koa = require('koa')
  , session = require('koa-session')
  , flash = require('koa-flash2');

var app = koa();

app.keys = ['foo'];
app.use(session(app));
app.use(flash());

app.use(function *() {
  if (this.method === 'POST') {
    this.flash('error', 'This is a flash error message.');
  } else if (this.method === 'GET') {
    this.body = this.flash('error');
  }
});

app.listen(3000);

License

MIT

About

Koa flash based connect-flash

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published