May 2018
Intermediate to advanced
470 pages
13h 54m
English
This Newsfeed-specific API will receive a request at the following route to be defined in server/routes/post.routes.js:
router.route('/api/posts/feed/:userId') .get(authCtrl.requireSignin, postCtrl.listNewsFeed)
We are using the :userID param in this route to specify the currently signed-in user, and we will utilize the userByID controller method in the user.controller to fetch the user details as we did before and append them to the request object that is accessed in the listNewsFeed post controller method. So, also add the following to the mern-social/server/routes/post.routes.js:
router.param('userId', userCtrl.userByID)
The post.routes.js file will be very similar to the user.routes.js file, and to load these new ...
Read now
Unlock full access