Skip to content

Instantly share code, notes, and snippets.

@Raynos
Created August 13, 2011 17:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Raynos/1144061 to your computer and use it in GitHub Desktop.
Save Raynos/1144061 to your computer and use it in GitHub Desktop.
r = require("request").defaults({
"json": true,
"headers": {
"Authorization": "Basic " + new Buffer(process.env.COUCH_USER + ":" + process.env.COUCH_PWD).toString("base64")
}
}),
var base_url = "http://raynos.iriscouch.com/raynos"
// data is an Object
r({
"uri": base_url,
"body": data,
"method": "POST"
}, error(function(err, resp, body) {
console.log(body);
}));
// returns
{
error: 'bad_request',
reason: 'Document must be a JSON object'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment