Nifty Procrastination Machine
    Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    tito-webhookpublic

    tito-webhook

    A Node.js middleware for Tito webhook requests.

    Build Status

    API

    webhook(path, callback)

    Mounts the Tito webhook middleware at path.

    callback(err, data)

    The callback is called once a webhook request has been recieved.

    Example

    Vanilla require('http'):

    var webhook = require('tito-webhook')
    var http = require('http')
     
    var _webhook = webhook('/', function done (err, data) {
      if (err) console.log(err)
      conosle.log(JSON.stringify(data))
    })
     
    var app = http.createServer(function server (req, res) {
      _webhook(req, res, function next () {
        res.statusCode = 404
        res.end()
      })
    })
     
    app.listen(1337)

    Connect:

    var webhook = require('tito-webhook')
    var connect = require('connect')
     
    var app = connect()
     
    app.use(webhook('/', function done (err, data) {
      if (err) console.log(err)
      conosle.log(JSON.stringify(data))
    })
     
    app.listen(1337)

    Express:

    var webhook = require('tito-webhook')
    var express = require('express')
     
    var app = express()
     
    app.use(webhook('/', function done (err, data) {
      if (err) console.log(err)
      conosle.log(JSON.stringify(data))
    })
     
    app.listen(1337)

    License

    MIT

    install

    npm i tito-webhook

    Downloadslast 7 days

    1

    version

    1.0.0

    license

    MIT

    repository

    github.com

    last publish

    collaborators

    • avatar