Adding view middleware.