-rw-r--r-- | backend/node/src/app.js | 7 | ||||
-rw-r--r-- | backend/node/src/clipperz.js | 6 |
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 @@ -37,6 +37,7 @@ app.use(require('express-session')({secret:'99 little bugs in the code', key:'si -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')) { 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 @@ -4,2 +4,4 @@ var BIGNUM = require('bignum'); var ASYNC = require('async'); +var EXPRESS = require('express'); +var PATH = require('path'); @@ -581,2 +583,6 @@ var CLIPPERZ = module.exports = function(CONFIG) { + (rv.router = require('express').Router()) + .post('/json',rv.json).get('/dump',rv.dump) + .use(EXPRESS.static(PATH.join(__dirname,'htdocs/'))); + return rv; |