author | Michael Krelin <hacker@klever.net> | 2014-06-29 19:56:24 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2014-06-29 20:48:06 (UTC) |
commit | a90f522c1e06149420a14100f34b252d7b1119c4 (patch) (side-by-side diff) | |
tree | abf7c66495d5634d1f509f60d36703416cdb15b3 /backend | |
parent | d07d0f16c064ddf2f51fb506ea77000d2eebce71 (diff) | |
download | clipperz-a90f522c1e06149420a14100f34b252d7b1119c4.zip clipperz-a90f522c1e06149420a14100f34b252d7b1119c4.tar.gz clipperz-a90f522c1e06149420a14100f34b252d7b1119c4.tar.bz2 |
update node modules and adjust for the newer express
-rw-r--r-- | backend/node/src/app.js | 18 | ||||
-rw-r--r-- | backend/node/src/clipperz.js | 2 | ||||
-rw-r--r-- | backend/node/src/package.json | 15 |
3 files changed, 20 insertions, 15 deletions
diff --git a/backend/node/src/app.js b/backend/node/src/app.js index 61c2c72..ca05e6f 100644 --- a/backend/node/src/app.js +++ b/backend/node/src/app.js @@ -21,31 +21,31 @@ 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); -app.use(EXPRESS.logger('dev')); -app.use(EXPRESS.urlencoded()); -app.use(EXPRESS.methodOverride()); -app.use(EXPRESS.cookieParser('your secret here')); -app.use(EXPRESS.session({secret:'99 little bugs in the code', key:'sid', store: clipperz.session_store() })); -app.use(app.router); +app.use(require('morgan')('dev')); +app.use(require('body-parser').urlencoded({extended:true})); +app.use(require('cookie-parser')('your secret here')); +app.use(require('express-session')({secret:'99 little bugs in the code', key:'sid', store: clipperz.session_store(), resave: false, saveUninitialized: false })); + +app.post('/json',clipperz.json); +app.get('/beta/dump',clipperz.dump); + app.use(EXPRESS.static(PATH.join(__dirname, 'htdocs/'))); if ('development' == app.get('env')) { - app.use(EXPRESS.errorHandler()); + app.use(require('express-error-with-sources')()); } -app.post('/json',clipperz.json); -app.get('/beta/dump',clipperz.dump); HTTP.createServer(app).listen(app.get('port'), function(){ LOGGER.info({port:app.get('port')},"Listener established"); }); diff --git a/backend/node/src/clipperz.js b/backend/node/src/clipperz.js index 04b054a..c51b0bc 100644 --- a/backend/node/src/clipperz.js +++ b/backend/node/src/clipperz.js @@ -1,18 +1,18 @@ var FS = require('fs'); var CRYPTO = require('crypto'); var BIGNUM = require('bignum'); var ASYNC = require('async'); -var express_store = require('express').session.Store; +var express_store = require('express-session').Store; function clipperz_hash(v) { return CRYPTO.createHash('sha256').update( CRYPTO.createHash('sha256').update(v).digest('binary') ).digest('hex'); }; function clipperz_random() { for(var r = '';r.length<64;r+=''+BIGNUM(Math.floor(Math.random()*1e18)).toString(16)); return r.substr(0,64); }; function clipperz_store(PG) { var rv = function(o) { express_store.call(this,o); } diff --git a/backend/node/src/package.json b/backend/node/src/package.json index 825f756..98755bd 100644 --- a/backend/node/src/package.json +++ b/backend/node/src/package.json @@ -1,15 +1,20 @@ { "name": "clipperz", "version": "0.0.0", "private": true, "scripts": { "start": "node app 2>&1 | ./node_modules/.bin/bunyan" }, "dependencies": { - "express": "3.4.4", - "async": "~0.2.9", - "bignum": "~0.6.2", - "pg": "~2.8.3", - "bunyan": "~0.22.0" + "async": "^0.9.0", + "bignum": "^0.8.0", + "body-parser": "^1.4.3", + "bunyan": "^0.23.1", + "cookie-parser": "^1.3.2", + "express": "^4.4.5", + "express-error-with-sources": "^1.3.1", + "express-session": "^1.6.1", + "morgan": "^1.1.1", + "pg": "^3.3.0" } } |