var http = require('http'); var mongo = require('mongodb').MongoClient; var app = express(); app.set('port', process.env.PORT || 8080); var mongodb; if(process.env.MONGO_URL) { mongo.connect(process.env.MONGO_URL, null, function(err, mongodb_) { if(err) { console.log(err); } else { mongodb = mongodb_; } }); } app.get('/users', function(req, res, next) { var collection = db.collection('users'); collection.find().toArray(function(err, result) { if(err) { res.sendStatus(500); return; } res.json(result); }); }); app.listen(app.get('port')); Retrieve all users