add example for writing as file in addition to serving as http