Skip to content

Instantly share code, notes, and snippets.

@janl janl/gist:4271837 forked from anonymous/gist:4267456
Created Dec 12, 2012

What would you like to do?
var cradle = require('cradle');
var usersdb = new(cradle.Connection)().database('users');
var documentsdb = new(cradle.Connection)().database('documents');
* GET users listing.
exports.user = getUser;
function getUser (req, res){
usersdb.get(req.params.username, function (err, doc) {
for (var i = 0;i <= doc.documents.length;i++){
//cycle the documents through getDocument
doc.documents[i] = getDocument(doc.documents[i]);
// render the paths and names of the documents (currently undefined)
res.render('user', doc);
function getDocument (documentID) {
var response = true;
documentsdb.get(documentID, function (err, doc) {
//get the path and name of each document from documents db
response = doc;
while (response){}
return response;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.