Tags support

This commit is contained in:
Adolfo Reyna
2025-07-17 09:32:27 -04:00
parent 46a2fc5c2b
commit 64ca9df639
3 changed files with 17 additions and 3 deletions

View File

@@ -97,13 +97,15 @@ DB.getDB.then((DB) => {
router.get("/tag/:tag", async (req, res) => {
const profileid = getProfileId(req);
const tag = req.params.tag;
const tag = req.query.tag || req.params.tag;
if(!tag) {
console.log("Tag query empty: ", tag);
return res.json({
status: "Tag is required",
});
}
let posts = await DB.getPostsByTag(tag, profileid);
console.log("Tag query: ", tag);
let posts = await DB.getPostsByTag('#' + tag, profileid);
return res.json(posts);
});