From db0dd042cc29136bc1135e2440828cf9000eef6e Mon Sep 17 00:00:00 2001 From: Zalmoxisus Date: Sun, 24 Jan 2016 11:05:12 +0200 Subject: [PATCH] Support ajax posting --- bin/worker.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bin/worker.js b/bin/worker.js index 5ca41b8..3461f30 100644 --- a/bin/worker.js +++ b/bin/worker.js @@ -11,6 +11,11 @@ module.exports.run = function(worker) { '

It works! Now point your app and monitor app to connect to this server.

' + ''); }); + app.post('/', function(req, res) { + if (!req.body.data) return res.status(404).end(); + scServer.exchange.publish('log', req.body.data); + res.send('OK'); + }); scServer.addMiddleware(scServer.MIDDLEWARE_EMIT, function (socket, channel, data, next) { if (channel.substr(0, 3) === 'sc-' || channel === 'respond' || channel === 'log') {