summaryrefslogtreecommitdiff
path: root/backend/node/src/app.js
authorMichael Krelin <hacker@klever.net>2014-07-01 17:49:10 (UTC)
committer Michael Krelin <hacker@klever.net>2014-07-01 17:49:10 (UTC)
commita6e5df547739ac91055ae0ae4928447c9ec50a98 (patch) (side-by-side diff)
treee5d2e63d8c782bb471fa95bd8c7d6d21e3c322b0 /backend/node/src/app.js
parentb9ee39b810aae10da83534776028585309b53a24 (diff)
downloadclipperz-master.zip
clipperz-master.tar.gz
clipperz-master.tar.bz2
clipperz middleware as a router instead of two separate handlers and staticHEADmaster
Diffstat (limited to 'backend/node/src/app.js') (more/less context) (show whitespace changes)
-rw-r--r--backend/node/src/app.js7
1 files changed, 4 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
@@ -14,38 +14,39 @@ var LOGGER = BUNYAN.createLogger({
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);
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(){
LOGGER.info({port:app.get('port')},"Listener established");
});