Code for chapter 04 of Meteor in Action