Skip to content

Instantly share code, notes, and snippets.

@MetaThis
Created August 25, 2011 22:03
Show Gist options
  • Star 11 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MetaThis/1172108 to your computer and use it in GitHub Desktop.
Save MetaThis/1172108 to your computer and use it in GitHub Desktop.
Simple example of a Node.js proxy to CouchDB GET requests
var http = require('http'),
request = require('request'), // request module from https://github.com/mikeal/request
url = require('url');
http.createServer(function (req, res) {
var href = url.parse(req.url,true).href;
request('http://127.0.0.1:5984' + href).pipe(res);
}).listen(1337);
// now try something like http://127.0.0.1:1337/your_db_name/_all_docs/?limit=10
@MetaThis
Copy link
Author

@isaacs @mikeal Thanks! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment