Support ajax posting
This commit is contained in:
parent
943a1c0120
commit
db0dd042cc
@ -11,6 +11,11 @@ module.exports.run = function(worker) {
|
|||||||
'<p>It works! Now point your app and monitor app to connect to this server.</p>' +
|
'<p>It works! Now point your app and monitor app to connect to this server.</p>' +
|
||||||
'</body></html>');
|
'</body></html>');
|
||||||
});
|
});
|
||||||
|
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) {
|
scServer.addMiddleware(scServer.MIDDLEWARE_EMIT, function (socket, channel, data, next) {
|
||||||
if (channel.substr(0, 3) === 'sc-' || channel === 'respond' || channel === 'log') {
|
if (channel.substr(0, 3) === 'sc-' || channel === 'respond' || channel === 'log') {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user