1.4.17 • Published 2 years ago

koa-github-hook-handler v1.4.17

Weekly downloads
68
License
BSD-2-Clause
Repository
github
Last release
2 years ago

npm License minified size downloads GitHub Issues Build Status Styled with prettier Commitizen friendly Known Vulnerabilities Coverage Status

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

WebhookHandler

Type: Function

Parameters

  • request Object decoded request body
  • event string from 'x-github-event' header
  • ctx Context from koa

createGithubHookHandler

Create a koa middleware suitable to bridge github webhook requests to KoaHandlers

Parameters

  • actions Object holding all the handles for the events (event is the key)

  • config Object (optional, default {})

    • config.secret string to decode signature

Returns KoaHandler suitable as koa middleware

createGiteaHookHandler

Create a koa middleware suitable to bridge gitea webhook requests to KoaHandlers

Parameters

  • actions Object holding all the handles for the events (event is the key)

  • config Object (optional, default {})

    • config.secret string to decode signature

Returns KoaHandler suitable as koa middleware

createBitbucketHookHandler

Create a koa middleware suitable to bridge gitea webhook requests to KoaHandlers

Parameters

  • actions Object holding all the handles for the events (event is the key)

  • config Object (optional, default {})

    • config.secret string to decode signature

Returns KoaHandler suitable as koa middleware

install

With npm do:

npm install koa-github-hook-handler

license

BSD-2-Clause

1.4.17

2 years ago

1.4.16

2 years ago

1.4.15

2 years ago

1.4.14

3 years ago

1.4.13

3 years ago

1.4.12

3 years ago

1.4.11

3 years ago

1.4.10

3 years ago

1.4.9

3 years ago

1.4.8

3 years ago

1.4.7

4 years ago

1.4.6

4 years ago

1.4.5

4 years ago

1.4.4

4 years ago

1.4.3

5 years ago

1.4.2

5 years ago

1.4.1

5 years ago

1.4.0

5 years ago

1.3.1

5 years ago

1.3.0

5 years ago

1.2.0

5 years ago

1.1.0

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago