Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/joshgillies/tito-webhook
A Node.js middleware for Tito webhook requests
https://github.com/joshgillies/tito-webhook
Last synced: 5 days ago
JSON representation
A Node.js middleware for Tito webhook requests
- Host: GitHub
- URL: https://github.com/joshgillies/tito-webhook
- Owner: joshgillies
- License: mit
- Created: 2015-04-04T11:37:10.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-08-30T10:05:20.000Z (about 9 years ago)
- Last Synced: 2024-11-07T07:02:38.531Z (8 days ago)
- Language: JavaScript
- Homepage:
- Size: 176 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# tito-webhook
A Node.js middleware for Tito webhook requests.
[![Build Status](https://travis-ci.org/joshgillies/tito-webhook.svg)](https://travis-ci.org/joshgillies/tito-webhook)
## 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')`:
```js
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:
```js
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:
```js
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