koa-github-hook-handler v1.4.17
koa-github-hook-handler
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 }
)
);API
Table of Contents
KoaHandler
Type: Function
Parameters
ctxContextnextFunction
WebhookHandler
Type: Function
Parameters
createGithubHookHandler
Create a koa middleware suitable to bridge github webhook requests to KoaHandlers
Parameters
actionsObject holding all the handles for the events (event is the key)actions.eventWebhookHandler (event is the key)
configObject (optional, default{})config.secretstring to decode signature
Returns KoaHandler suitable as koa middleware
createGiteaHookHandler
Create a koa middleware suitable to bridge gitea webhook requests to KoaHandlers
Parameters
actionsObject holding all the handles for the events (event is the key)actions.eventWebhookHandler (event is the key)
configObject (optional, default{})config.secretstring to decode signature
Returns KoaHandler suitable as koa middleware
createBitbucketHookHandler
Create a koa middleware suitable to bridge gitea webhook requests to KoaHandlers
Parameters
actionsObject holding all the handles for the events (event is the key)actions.eventWebhookHandler (event is the key)
configObject (optional, default{})config.secretstring to decode signature
Returns KoaHandler suitable as koa middleware
install
With npm do:
npm install koa-github-hook-handlerlicense
BSD-2-Clause
4 years ago
4 years ago
4 years ago
4 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago