forked from tdebarochez/connect-couchdb
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.js
More file actions
20 lines (18 loc) · 662 Bytes
/
example.js
File metadata and controls
20 lines (18 loc) · 662 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
var connect = require('connect'),
connectCouchDB = require('connect-couchdb');
function helloWorld(req, res) {
if (!req.session.tick) {
req.session.tick = 0;
}
res.writeHead(200, { 'Content-Type': 'text/plain' });
if (req.url == '/') {
req.session.tick++;
res.write('hello world : ' + req.session.tick);
}
res.end('');
}
var server = connect.createServer(connect.cookieDecoder(),
connect.session({secret: 'your secret passphrase',
store: new connectCouchDB({database: "test"})}),
helloWorld);
server.listen(3000);