New way of registering rest middlewares.