Skip to content

Conversation

Mark-Klocek
Copy link

Following changes to allow comments:

-Added "add comment" button to post.ejs if user.id and post.user are not the same
-input form and button to action /post/addComment/post.id
-added comments model for comments collection
-in router, added new route for /addComment/:id
-in controller, created new method called addComments(made sure after comment was added to redirect to current post)
-updated getPost method in post controller to make a db call to the posts collection for all comments with the post id
-updated getPost rendering to take in new parameter, posts, that defaults to an empty array if there are no posts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant