antiboredom / servi.js

36 stars 6 forks source link

option for enabling directory listing #10

Open shiffman opened 9 years ago

shiffman commented 9 years ago

While I recognize that in most "real world" cases this is a bad idea, for teaching I would love an option to enable automatic listing of directories/files when serving a directory. This is helpful if I have a whole bunch of examples that I just want to click around through and show without having to build an index page and is also useful for just demonstrating how the directory structure is shown.

directoryList(true);? enableDirectoryList();? listDirectory(true);?

vanevery commented 9 years ago

I think that should be an optional argument to the serveFiles(directory) method:

serveFiles(directory, [enableDirectoryList]) with a default to false.