Skip to content

Instantly share code, notes, and snippets.

@BigBlueHat
Created May 18, 2012 19:13
Show Gist options
  • Select an option

  • Save BigBlueHat/2727111 to your computer and use it in GitHub Desktop.

Select an option

Save BigBlueHat/2727111 to your computer and use it in GitHub Desktop.
WebHook _update endpoint for CouchDB
{
"_id": "_design/webhook",
"_rev": "4-4a793a444b5e524a7b1df4259b892366",
"updates": {
"receive": "function(doc, req) { if (req._id == null && req.form.payload) { newdoc = JSON.parse(req.form.payload); newdoc._id = req.uuid; newdoc['.'] = {\"webook\": {\"created\": Date()}}; return [newdoc, 'woot!']; } else { return [null, 'fale']; } }"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment