Skip to content

Instantly share code, notes, and snippets.

@guiomie
Created October 2, 2011 23:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save guiomie/1258099 to your computer and use it in GitHub Desktop.
Save guiomie/1258099 to your computer and use it in GitHub Desktop.
Calling getParcourList returns undefined all the time
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