https://github.com/joshgillies/tito-webhook
A Node.js middleware for Tito webhook requests
https://github.com/joshgillies/tito-webhook
Last synced: 5 months 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 10 years ago)
- Default Branch: master
- Last Pushed: 2015-08-30T10:05:20.000Z (almost 10 years ago)
- Last Synced: 2025-02-12T01:43:03.221Z (5 months 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.
[](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