helper function to serve directory listings

  and updated the file-server example to use this helper function