Skip to content

Commit

Permalink
updated flash-test middleware for JSGI B
Browse files Browse the repository at this point in the history
  • Loading branch information
nrstott committed Jan 9, 2012
1 parent 537fe92 commit b3fe749
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions examples/flash-test.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,29 @@
var bogart = require('../lib/bogart');

var router = bogart.router();

var config = function(show, create, update, destroy) {
show('/flash', function(req) {
var existing = "Existing Flash:"+ req.flash("foo") +"<br />";
req.flash("foo", Math.random() * 10);
return bogart.html(existing);
});
};
router.get('/flash', function(req) {
var existing = 'Existing Flash:'+req.flash('foo')+'<br />';

req.flash('foo', Math.random() * 10);

console.log('existing', existing);

return bogart.html(existing);
});

//the following config options are optional, defaults are assumed
var flashConfig = {
options: {
dataProvider: {
encryptionKey:"db0031e2-04e7-11e1-86ad-000c290196f7"
encryptionKey: 'db0031e2-04e7-11e1-86ad-000c290196f7'
},
idProvider: {}
}
};

var app = bogart.middleware.Flash(flashConfig, bogart.router(config));
bogart.start(app, {port:1337});
var app = bogart.app();
app.use(bogart.middleware.flash(flashConfig));
app.use(router);

app.start();

0 comments on commit b3fe749

Please sign in to comment.