Skip to content

Instantly share code, notes, and snippets.

@tmzt
Created April 6, 2011 17:56
Show Gist options
  • Save tmzt/906150 to your computer and use it in GitHub Desktop.
Save tmzt/906150 to your computer and use it in GitHub Desktop.
app.get('/apis/v0/sectiondata/:id.json', function(req, res) {
var idx = parseInt(req.params.id);
var user_id = req.session.user_id || null;
getprivate(req, res, function(profile) {
if (profile != null) user_id = profile._id;
if (user_id != null) {
SectionData.findOne({ownerid: user_id, idx: idx}, function(err, doc) {
console.log('doc: ', doc);
if (err == null) {
res.send(doc);
} else { handleError(err); res.send(500); }
});
} else { res.send(404); }
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment