middleware for coffeescript classes