Skip to content
This repository was archived by the owner on Nov 5, 2018. It is now read-only.

Commit

Permalink
Merge pull request #328 from exclsr/patch-2
Browse files Browse the repository at this point in the history
Update express.js example for nano 6 and express 4
  • Loading branch information
jo committed May 16, 2016
2 parents b41279f + 286bf46 commit 9ddc649
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions examples/express.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,19 @@

var express = require('express')
, db = require('nano')('http://localhost:5984/my_couch')
, app = module.exports = express.createServer()
, app = module.exports = express()
;

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.get('/', function(req, res) {
db.get('foo', function (error, body, headers) {
if(error) {
res.status(error.statusCode);
return res.send(error.message);
}
res.status(200);
res.send(body);
});
});

app.listen(3333);
console.log('server is running. check expressjs.org for more cool tricks');
console.log('server is running. check expressjs.com for more cool tricks');

0 comments on commit 9ddc649

Please sign in to comment.