// GET /cms/posts/:id/comments — public list of APPROVED comments for a post. import "util" as util; let post_id = ctx.request.params.id; let comments = docs::collection("comments"); let rows = comments.find(#{ post_id: post_id, status: "approved", "$sort": #{ created_at: 1 }, "$limit": 200, }); let out = []; for r in rows { let c = util::shape_doc(r); c.remove("author_email"); // never expose commenter emails publicly out.push(c); } #{ statusCode: 200, body: #{ comments: out } }