tweaking and adding homepage with trending and so on

This commit is contained in:
2024-01-25 16:25:03 +01:00
parent 421ab338fc
commit 3ad55cd36a
8 changed files with 351 additions and 2 deletions
+3
View File
@@ -11,6 +11,9 @@ router.get('/:id', async (req, res) => {
const post = await db.query(`SELECT * FROM posts WHERE id = "${id}"`);
if(post.length == 0) return res.status(400).json({error: "Post does not exist"});
else {
const viewPost = await db.query(`UPDATE posts SET viewcount += 1 WHERE id = "${postId}"`);
}
res.status(200).json({post});
}