diff --git a/examples/express.js b/examples/express.js index 51dceacb..b49ba1d0 100644 --- a/examples/express.js +++ b/examples/express.js @@ -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');