bug 828505 - document how to write middleware

@twobraids r?