Add $app parameter for application middlewares (before, after, finish)