Middleware with block