From 38354f6ae5bf159565df7924d12a4c27c7207fe3 Mon Sep 17 00:00:00 2001 From: booo Date: Wed, 8 Feb 2012 13:57:04 +0100 Subject: [PATCH] move 'debug' routes into own module --- node/routes/debug.js | 25 +++++++++++++++++++++++++ node/server.js | 24 +++--------------------- 2 files changed, 28 insertions(+), 21 deletions(-) create mode 100644 node/routes/debug.js diff --git a/node/routes/debug.js b/node/routes/debug.js new file mode 100644 index 000000000..ad0184fdc --- /dev/null +++ b/node/routes/debug.js @@ -0,0 +1,25 @@ +var formidable = require('formidable'); + +module.exports = function(app) +{ + //The Etherpad client side sends information about how a disconnect happen + app.post('/ep/pad/connection-diagnostic-info', function(req, res) + { + new formidable.IncomingForm().parse(req, function(err, fields, files) + { + console.log("DIAGNOSTIC-INFO: " + fields.diagnosticInfo); + res.end("OK"); + }); + }); + + //The Etherpad client side sends information about client side javscript errors + app.post('/jserror', function(req, res) + { + new formidable.IncomingForm().parse(req, function(err, fields, files) + { + console.error("CLIENT SIDE JAVASCRIPT ERROR: " + fields.errorInfo); + res.end("OK"); + }); + }); + +}; diff --git a/node/server.js b/node/server.js index a6a57497a..8d8462fd7 100644 --- a/node/server.js +++ b/node/server.js @@ -352,27 +352,9 @@ async.waterfall([ apiCaller(req, res, fields) }); }); - - //The Etherpad client side sends information about how a disconnect happen - app.post('/ep/pad/connection-diagnostic-info', function(req, res) - { - new formidable.IncomingForm().parse(req, function(err, fields, files) - { - console.log("DIAGNOSTIC-INFO: " + fields.diagnosticInfo); - res.end("OK"); - }); - }); - - //The Etherpad client side sends information about client side javscript errors - app.post('/jserror', function(req, res) - { - new formidable.IncomingForm().parse(req, function(err, fields, files) - { - console.error("CLIENT SIDE JAVASCRIPT ERROR: " + fields.errorInfo); - res.end("OK"); - }); - }); - + + require('./routes/debug')(app); + //serve index.html under / app.get('/', function(req, res) {