bug 828505 - document how to write middleware, r=twobraids