<WIP> #52
This commit is contained in:
@@ -58,6 +58,7 @@ app.use((req, res, next) => {
|
||||
next();
|
||||
});
|
||||
|
||||
require('./service/github')(app);
|
||||
require('./service/twitter')(app);
|
||||
|
||||
module.exports = app;
|
||||
|
18
src/api/service/github.ts
Normal file
18
src/api/service/github.ts
Normal file
@@ -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);
|
||||
});
|
||||
};
|
Reference in New Issue
Block a user