Created
October 2, 2011 23:24
-
-
Save guiomie/1258099 to your computer and use it in GitHub Desktop.
Calling getParcourList returns undefined all the time
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var getParcourList = function(userId){ | |
GeneralReference.findOne({ id: userId}, function(err, result){ | |
if(err){ | |
console.log("error in save: " + err); | |
return "No Document found: " + err; | |
}else{ | |
//console.log(JSON.strinresult.parcours); | |
return result.parcours; | |
} | |
}); | |
} | |
app.get("/parcour/list/:userId", function(req, res){ | |
var json = mongooseLogic.getParcourList(req.params.userId); | |
if(json === undefined){ | |
console.log('No data'); | |
res.json('No data'); | |
}else{ | |
console.log(json); | |
res.json(json) | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment