handle github/gitea/bitbucket requests
import Koa from "koa";
import Router from "koa-better-router";
import { createGithubHookHandler } from "koa-github-hook-handler";
...
const router = Router();
const secret = "...";
router.addRoute(
"POST",
"/hook",
createGithubHookHandler(
{
push: async request => {
console.log("PUSH",request);
return { ok: true };
}
},
{ secret }
)
);
- Context
- KoaHandler
- WebhookHandler
- createGithubHookHandler
- createGiteaHookHandler
- createBitbucketHookHandler
Type: Object
Type: Function
Type: Function
Create a koa middleware suitable to bridge github webhook requests to KoaHandlers
-
actions
Object holding all the handles for the events (event is the key)actions.default
Function default actionactions.event
WebhookHandler (event is the key)
-
config
Objectconfig.secret
string to decode signature
Returns KoaHandler suitable as koa middleware
Create a koa middleware suitable to bridge gitea webhook requests to KoaHandlers
-
actions
Object holding all the handles for the events (event is the key)actions.default
Function default actionactions.event
WebhookHandler (event is the key)
-
config
Objectconfig.secret
string to decode signature
Returns KoaHandler suitable as koa middleware
Create a koa middleware suitable to bridge gitea webhook requests to KoaHandlers
-
actions
Object holding all the handles for the events (event is the key)actions.default
Function default actionactions.event
WebhookHandler (event is the key)
-
config
Objectconfig.secret
string to decode signature
Returns KoaHandler suitable as koa middleware
With npm do:
npm install koa-github-hook-handler
BSD-2-Clause