Add a middleware.