add a middleware