Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[samples] two more from blogposts

  • Loading branch information...
commit af9f5d1dc6b8b287781bb3058fe6475b377eab1e 1 parent 10cfa39
@dscape authored
Showing with 26 additions and 0 deletions.
  1. +15 −0 samples/express.js
  2. +11 −0 samples/pipe.js
View
15 samples/express.js
@@ -0,0 +1,15 @@
+var express = require('express')
+ , db = require('nano')('http://localhost:5984/my_couch')
+ , app = module.exports = express.createServer()
+ ;
+
+app.get("/", function(request,response) {
+ db.get("foo", function (error, body, headers) {
+ if(error) { return response.send(error.message, error['status-code']); }
+ response.send(body, 200);
+ });
+ });
+});
+
+app.listen(3333);
+console.log("server is running. check expressjs.org for more cool tricks");
View
11 samples/pipe.js
@@ -0,0 +1,11 @@
+var express = require('express')
+ , nano = require('nano')('http://localhost:5984')
+ , app = module.exports = express.createServer()
+ , db_name = "test"
+ , db = nano.use(db_name);
+
+app.get("/", function(request,response) {
+ db.attachment.get("new", "logo.png").pipe(response);
+});
+
+app.listen(3333);
Please sign in to comment.
Something went wrong with that request. Please try again.