Commit 7d1ec560 authored by andreagerino's avatar andreagerino

...

parent 740ff4c5
...@@ -20,7 +20,44 @@ mongoClient.connect(mongoUrl, function(err, db) { ...@@ -20,7 +20,44 @@ mongoClient.connect(mongoUrl, function(err, db) {
router.get('/:resource_id', function(req, res, next) { router.get('/:resource_id', function(req, res, next) {
res.sendStatus(200); var _id = req.params.resource_id;
mongoClient.connect(mongoUrl, function(err, db) {
if(err!=null){
debug(err);
next(err);
}else{
var collection = db.collection('resources');
collection.find({"_id":_id}).limit(1).next(function(err, doc){
if(err!=null){
debug(err);
next(err);
}else{
if(doc==undefined){
res.sendStatus(400);
}else{
res.send(doc);
}
}
});
}
});
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment