GithubHelp home page GithubHelp logo

hu19891110 / coding-webhook-handler Goto Github PK

View Code? Open in Web Editor NEW

This project forked from spacelan/coding-webhook-handler

0.0 3.0 0.0 196 KB

Node.js web handler / middleware for processing Coding Webhooks

License: MIT License

JavaScript 100.00%

coding-webhook-handler's Introduction

coding-webhook-handler

Build Status

Coding allows you to register Webhooks for your repositories. Each time an event occurs on your repository, whether it be pushing code, filling issues or creating pull requests, the webhook address you register can be configured to be pinged with details.

This library is a fork of github-webhook-handler. It is a small handler (or "middleware" if you must) for Node.js web servers that handles all the logic of receiving and verifying webhook requests from Coding.

Install

npm install coding-webhook-handler

Example

var http = require('http')
var createHandler = require('coding-webhook-handler')
var handler = createHandler({
  path: '/webhook',
  token: 'mytoken' // maybe there is no token
})

http.createServer(function(req, res) {
  handler(req, res, function(err) {
    res.statusCode = 404
    res.end('no such location')
  })
}).listen(7777)

handler.on('error', function(err) {
  console.error('Error:', err.message)
})

handler.on('*', function(event) {
  console.log(event.event)
  console.log(event.payload)
  console.log(event.protocol)
  console.log(event.host)
  console.log(event.url)
})

handler.on('push', function(event) {
  console.log(event)
})

handler.on('star', function(event) {
  console.log(event)
})

License

MIT

coding-webhook-handler's People

Contributors

etroid avatar heitortsergent avatar henter avatar klh avatar olls avatar rvagg avatar spacelan avatar tmpvar avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.