Skip to content

Instantly share code, notes, and snippets.

@JulesAU
Last active March 18, 2020 04:53
Show Gist options
  • Save JulesAU/60cd18fcd5a4a0f77f49f0004afafb60 to your computer and use it in GitHub Desktop.
Save JulesAU/60cd18fcd5a4a0f77f49f0004afafb60 to your computer and use it in GitHub Desktop.
Receiving JSON Wormly Alerts in NodeJS
// Receive alerts from the Wormly Webhook Alert channel.
// https://www.wormly.com/help/channels/http-rpc
require('http').createServer(function (req, res) {
var alert = '';
req.on('data', function (chunk) { alert += chunk.toString() });
req.on('end', function () {
if (req.headers['content-type'] === 'application/json') {
alert = JSON.parse(alert);
}
console.log(alert);
res.end('OK');
});
}).listen(port)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment