Open jonrimmer opened 5 years ago
This sounds like good stuff - I believe https://github.com/jfhbrook/node-ecstatic/blob/master/lib/ecstatic.js#L352-L371 is the code that would need to be refactored. A number of new tests would need to be written as well.
If someone wants to tackle this I would definitely take this!
This issue is also likely relevant - in a similar location in the code and probably worth wrapping into the same PR: https://github.com/jfhbrook/node-ecstatic/issues/88
I was trying to use Ecstatic (via http-server) to serve Angular's ES2015 modules. This means serving with
.js
default extension. I had problems because they have some files named e.g.metadata.js
that also have a corresponding directory with the same name. Attempting to import./metadata
resolves to the directory, but since there is noindex.js
inside it, andshowDir
isfalse
, this results in a 404. In this case, I think Ecstatic should fall back to serving the document with the default extension, if one exists.I.e the proposed logic would be this:
showDir: true
: Show file list.