Chapter 11. Refactoring

 

This chapter covers

  • Organizing, implementing, and refactoring a project pivot
  • Using the async library in Sails
  • Customizing built-in responses
  • Adding a password-recovery system

It’s been several months since we delivered the last version of Brushfire to Chad. We thought we’d begin work on the next phase of content management: associating users with the videos they added. But when Chad arrived at our offices, plans had changed. Chad was anxious to give us some good news and some bad news. The bad news was his investor/mom was again shaken by the lack of cat videos on Brushfire. She could not “in good conscience” continue to subsidize the proliferation of “videos without cats.” We explained to Chad that although we could associate users with the videos they added, thereby identifying violations of his mom’s Terms of Service, we could not manufacture exclusive interest in cats. He understood and added, “None of that mattered when compared to the other exciting development.”

Chad’s good news was the spectacular growth in traffic generated by do-it-yourself (DIY) videos on Brushfire during our hiatus. Brushfire users were adding their favorite how-to YouTube videos at a phenomenal rate. Bottom line, he said, “The market had spoken,” and he would take the last of his mom’s investment and pivot once again.

11.1. Maintaining your sanity when requirements change

11.2. Custom routing and error pages

11.3. Adjusting access control rules

11.4. Patterns and best practices

11.5. In depth: adding a password-recovery flow

11.6. Summary