Server that responds to webhooks

This commit is contained in:
Brandon Keepers 2016-09-16 09:10:30 -07:00
parent 1f838dfb1c
commit 6ca4415c72
2 changed files with 32 additions and 0 deletions

18
package.json Normal file
View File

@ -0,0 +1,18 @@
{
"name": "probot",
"version": "1.0.0",
"description": "a trainable robot that responds to activity on GitHub",
"main": "index.js",
"scripts": {
"test": "mocha"
},
"author": "Brandon Keepers",
"license": "ISC",
"dependencies": {
"github": "^3.1.0",
"github-webhook-handler": "^0.6.0"
},
"devDependencies": {
"mocha": "^3.0.2"
}
}

14
server.js Normal file
View File

@ -0,0 +1,14 @@
var http = require('http')
var createHandler = require('github-webhook-handler')
var handler = createHandler({ path: '/', secret: 'secret' })
http.createServer(function (req, res) {
handler(req, res, function (err) {
res.statusCode = 404
res.end('no such location')
})
}).listen(3000)
handler.on('pull_request', function (event) {
console.log('event', event);
})