summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--backend/node/src/app.js7
-rw-r--r--backend/node/src/clipperz.js6
2 files changed, 10 insertions, 3 deletions
diff --git a/backend/node/src/app.js b/backend/node/src/app.js
index bbc62f8..09dcfac 100644
--- a/backend/node/src/app.js
+++ b/backend/node/src/app.js
@@ -30,20 +30,21 @@ var clipperz = CLIPPERZ({
var app = EXPRESS();
app.set('port', process.env.PORT || 3000);
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('/dump',clipperz.dump);
+/* Like this: */
+app.use(clipperz.router);
+/* Or this: */
+app.use('/clz/',clipperz.router);
-app.use(EXPRESS.static(PATH.join(__dirname, 'htdocs/')));
if ('development' == app.get('env')) {
app.use(require('express-error-with-sources')());
}
HTTP.createServer(app).listen(app.get('port'), function(){
diff --git a/backend/node/src/clipperz.js b/backend/node/src/clipperz.js
index 842de31..2a3df73 100644
--- a/backend/node/src/clipperz.js
+++ b/backend/node/src/clipperz.js
@@ -1,12 +1,14 @@
var FS = require('fs');
var CRYPTO = require('crypto');
var BIGNUM = require('bignum');
var ASYNC = require('async');
+var EXPRESS = require('express');
+var PATH = require('path');
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');
};
@@ -574,11 +576,15 @@ var CLIPPERZ = module.exports = function(CONFIG) {
+"Clipperz.PM.Proxy.defaultProxy = new Clipperz.PM.Proxy.Offline();"
+"Clipperz.Crypto.PRNG.defaultRandomGenerator().fastEntropyAccumulationForTestingPurpose();"));
});
}
};
rv.__defineGetter__('session_store',function(){ return function(o) { return new (clipperz_store(PG))(o) } });
+ (rv.router = require('express').Router())
+ .post('/json',rv.json).get('/dump',rv.dump)
+ .use(EXPRESS.static(PATH.join(__dirname,'htdocs/')));
+
return rv;
};