author | Michael Krelin <hacker@klever.net> | 2013-11-25 20:52:38 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2013-11-25 20:52:38 (UTC) |
commit | 352f2216eec032efce4bdeddd2ffe5a9e326a99d (patch) (side-by-side diff) | |
tree | 902272eaff4d42c0e732cc446baa3b5958cfae73 /backend/node/src/app.js | |
parent | c79ee694f71f787e896fe3f954316723ef0f5544 (diff) | |
download | clipperz-352f2216eec032efce4bdeddd2ffe5a9e326a99d.zip clipperz-352f2216eec032efce4bdeddd2ffe5a9e326a99d.tar.gz clipperz-352f2216eec032efce4bdeddd2ffe5a9e326a99d.tar.bz2 |
postgresql-based clipperz own session store
the use thereof is not mandatory, but may come in handy for the
standalone deployment
-rw-r--r-- | backend/node/src/app.js | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/backend/node/src/app.js b/backend/node/src/app.js index d4d60c2..61c2c72 100644 --- a/backend/node/src/app.js +++ b/backend/node/src/app.js @@ -17,6 +17,16 @@ var EXPRESS = require('express'); var HTTP = require('http'); var PATH = require('path'); + +var CLIPPERZ = require('./clipperz'); +var CONF = require('./conf'); +var clipperz = CLIPPERZ({ + psql: CONF.psql||'postgresql:///clipperz', + logger: LOGGER, + dump_template: PATH.join(__dirname,'htdocs/beta/index.html') +}); + + var app = EXPRESS(); app.set('port', process.env.PORT || 3000); @@ -24,7 +34,7 @@ app.use(EXPRESS.logger('dev')); app.use(EXPRESS.urlencoded()); app.use(EXPRESS.methodOverride()); app.use(EXPRESS.cookieParser('your secret here')); -app.use(EXPRESS.session()); +app.use(EXPRESS.session({secret:'99 little bugs in the code', key:'sid', store: clipperz.session_store() })); app.use(app.router); app.use(EXPRESS.static(PATH.join(__dirname, 'htdocs/'))); if ('development' == app.get('env')) { @@ -32,14 +42,6 @@ if ('development' == app.get('env')) { } -var CLIPPERZ = require('./clipperz'); -var CONF = require('./conf'); -var clipperz = CLIPPERZ({ - psql: CONF.psql||'postgresql:///clipperz', - logger: LOGGER, - dump_template: PATH.join(__dirname,'htdocs/beta/index.html') -}); - app.post('/json',clipperz.json); app.get('/beta/dump',clipperz.dump); |