Create a middleware using rack framework