compilation occurs when the middleware is invoked.