Skip to content

Instantly share code, notes, and snippets.

@rtyler
Created December 17, 2016 00:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rtyler/25e8102dda96281531d685eaf16f627e to your computer and use it in GitHub Desktop.
Save rtyler/25e8102dda96281531d685eaf16f627e to your computer and use it in GitHub Desktop.
{
"bindings": [
{
"authLevel": "function",
"type": "httpTrigger",
"direction": "in",
"name": "req"
},
{
"type": "http",
"direction": "out",
"name": "$return"
},
{
"type": "eventHub",
"name": "outputEventHubMessage",
"path": "github-events",
"connection": "github-events",
"direction": "out"
},
{
"type": "documentDB",
"name": "outputDocument",
"databaseName": "rtyler-github-events",
"collectionName": "jenkins-infra",
"createIfNotExists": false,
"connection": "rtyler-github-events_DOCUMENTDB",
"direction": "out"
}
],
"disabled": false
}
module.exports = function (context, req) {
context.log('JavaScript HTTP trigger function processed a request.');
if (req.body) {
context.log(req.body);
var gh_event = {
event: req.body,
received: new Date().toISOString()
};
context.bindings.outputEventHubMessage = gh_event;
context.bindings.outputDocument = JSON.stringify(gh_event);
res = {
// status: 200, /* Defaults to 200 */
body: "Thanks for the GitHub event"
};
}
context.done(null, res);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment