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 |
I love JavaScript, but after using CoffeeScript for the past two weeks, JavaScript just looks so noisy. I don't have to worry about compiling though. I have "coffee -cwo ..." running so all the files get compiled in the background. BTW mikeal, thanks so much for everything you've done for the Node community! I use your modules often!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
in 0.5.x you can do