27/11/2020 — Creating Posts

Acebookgroup2
Dec 4, 2020

A key function of the app is to allow users to share their experiences with others by posting comments to the wall.

We needed to add the ability for ‘comments’ to be saved alongside the date and owner’s details in the database so that they can be recalled on the Timeline page and in the User’s personal profile page:

Saving posts (‘comments’) to our mongoDB database

We also had to create the ‘new post’ function in our posts.js controller. We also duplicated this functionality within the ‘profile’ controller to allow users to make posts directly from their profiles pages.

Creating a new post controller file — posts.js

Next, we created a new-post-form in our Handlebars file which captures and displays the users posts on the Timeline page:

Timeline of posts page

--

--