summaryrefslogtreecommitdiff
path: root/src/api
diff options
context:
space:
mode:
Diffstat (limited to 'src/api')
-rw-r--r--src/api/server.ts1
-rw-r--r--src/api/service/github.ts18
2 files changed, 19 insertions, 0 deletions
diff --git a/src/api/server.ts b/src/api/server.ts
index 5f8de5719f..e94a7797f2 100644
--- a/src/api/server.ts
+++ b/src/api/server.ts
@@ -58,6 +58,7 @@ app.use((req, res, next) => {
next();
});
+require('./service/github')(app);
require('./service/twitter')(app);
module.exports = app;
diff --git a/src/api/service/github.ts b/src/api/service/github.ts
new file mode 100644
index 0000000000..680c02c47a
--- /dev/null
+++ b/src/api/service/github.ts
@@ -0,0 +1,18 @@
+import * as express from 'express';
+const createHandler = require('github-webhook-handler');
+import config from '../../conf';
+
+module.exports = (app: express.Application) => {
+ if (config.github_bot == null) return;
+
+ const handler = createHandler({
+ path: '/hooks/github',
+ secret: config.github_bot.hook_secret
+ });
+
+ app.post('/hooks/github', handler);
+
+ handler.on('*', event => {
+ console.dir(event);
+ });
+};