Skip to content

Instantly share code, notes, and snippets.

@antstanley
Last active May 29, 2018 09:55
Show Gist options
  • Save antstanley/54ba95e8761cde5d760ea216ba267f6c to your computer and use it in GitHub Desktop.
Save antstanley/54ba95e8761cde5d760ea216ba267f6c to your computer and use it in GitHub Desktop.
example to publish event to Azure Event Grid using Request module and Azure REST interface
const request = require('request');
function publishEvent(topicURL, topicSecret, eventPayload, callback) {
const options = {
method: 'POST',
url: topicURL,
headers: {
'aeg-sas-key': topicSecret
},
json: true,
body: [eventPayload]
}
request(options, (err, response, body) => {
if (err) {
callback(err)
} else {
callback(null, true);
}
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment