Skip to content

Instantly share code, notes, and snippets.

@gartdan
Created June 3, 2015 15:00
Show Gist options
  • Save gartdan/a0366b4234f08714e475 to your computer and use it in GitHub Desktop.
Save gartdan/a0366b4234f08714e475 to your computer and use it in GitHub Desktop.
app.get('/sensorData', function (req, res) {
var temp = req.query.temp;
var humidity = req.query.humidity;
var deviceId = req.query.deviceId;
var client = require('event-hub-client').restClient(
config.namespace,
config.hub,
config.sharedAccessKeyName,
config.sharedAccessKey);
console.log("Sending message");
client.sendMessage('{ "temp": '+ temp +', "humidity": '+ humidity + ', "deviceId": "'+ deviceId + '"}', callback);
res.send("Message sent");
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment