Tags support
This commit is contained in:
@@ -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);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user