Created
May 24, 2012 23:20
-
-
Save streunerlein/2784839 to your computer and use it in GitHub Desktop.
How to pipe attachments from couchdb - without losing nice caching effects [nano]
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 couchconfig = { | |
hostname: "localhost" | |
} | |
var nano = require("./nano/nano.js")("http://" + couchconfig.hostname + ":5984"), | |
db = nano.use("nano-test"), | |
express = require("express"); | |
var app = express.createServer(); | |
app.get('/', function(req, res){ | |
req.headers.host = couchconfig.host; | |
nano.request({ | |
db: "nano-test", | |
doc: "test", | |
att: "latest-xkcd.png", | |
headers: req.headers | |
}).pipe(res); | |
}); | |
app.listen(3000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Note, as of this date this example only works with the modified version of nano, where headers can be passed to nano.request()... (see https://github.com/streunerlein/nano)
A pull request to the original nano is in progress...