Created
December 17, 2016 00:04
-
-
Save rtyler/25e8102dda96281531d685eaf16f627e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"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 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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