Skip to content

Instantly share code, notes, and snippets.

@tmzt

tmzt/gist:906150

Created Apr 6, 2011
Embed
What would you like to do?
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