Chapter 13. Ratings, followers, and search

 

This chapter covers

  • Creating a rating system for tutorials
  • Understanding follower/following associations
  • Building search into Brushfire
  • Incorporating pagination for tutorials and a sorting mechanism for videos

You’re now well into your post-pivot journey that started in chapter 11. In chapter 12, you learned how to establish relationships between models using embedded values and Waterline associations. In this chapter, you’ll build on that knowledge to implement other requirements of Brushfire, including adding videos, rating content, following users, searching, and more. We’ll end with a review of policies and restrictions in actions that manage access to various features. So let’s get started.

13.1. Obtaining the example materials for this chapter

If you followed along in chapter 12 with an existing project, you can continue to use that project in this chapter. If, however, you want to start from this chapter and move forward, clone the following repo: https://github.com/sailsinaction/brushfire-ch12-end. After cloning the repo, install the Node module dependencies via npm install. You’ll also want to add the local.js file you created in chapter 11. In Sublime, create a new file in brushfire/config/local.js, and add the following code.

13.2. Incorporating ratings

13.3. Implementing videos

13.4. Implementing support for followers

13.5. Search

13.6. Summary