Created
August 25, 2011 22:03
-
-
Save MetaThis/1172108 to your computer and use it in GitHub Desktop.
Simple example of a Node.js proxy to CouchDB GET requests
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@isaacs @mikeal Thanks! :)