Permalink
Browse files

Added chaos store example

  • Loading branch information...
1 parent 2562c56 commit bce9dded90f795486d4e846ce519189a52994598 @stagas stagas committed Mar 31, 2011
Showing with 18 additions and 0 deletions.
  1. +18 −0 examples/chaos.js
View
@@ -0,0 +1,18 @@
+var connect = require('connect');
+var webserver = connect.createServer();
+
+webserver.use(require('sesame')({
+ store : require('chaos')(__dirname + '/chaos.db').mount('sessions')
+}));
+
+webserver.use(connect.router(function (app) {
+ app.get('/', function (req, res) {
+ req.session.times = (req.session.times || 0) + 1;
+
+ res.writeHead(200, { 'Content-Type' : 'text/plain' });
+ res.end(req.session.times + ' times!');
+ });
+}));
+
+console.log('Listening on 9090');
+webserver.listen(9090);

0 comments on commit bce9dde

Please sign in to comment.