post by user

This commit is contained in:
Adolfo Reyna
2021-08-15 22:19:35 -07:00
parent 5b9c0362e0
commit f909233533
2 changed files with 11 additions and 3 deletions

View File

@@ -16,6 +16,12 @@ DB.getDB.then((DB)=>{
return res.json(posts)
});
router.get("/usr/:id", async (req, res) => {
const userid = req.params.id;
const posts = await DB.getPosts(userid);
return res.json(posts)
});
router.get("/new", async (req, res) => {
let post = {
userid: getUserId(req),
@@ -46,7 +52,8 @@ DB.getDB.then((DB)=>{
r = await DB.newComment(postid, comment);
console.log(r)
return res.json({
status: "ok"
status: "ok",
...comment
})
});