Adds `middleware` method to create Connect middleware