expressjs / serve-index

Serve directory listings

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Multiple path support

matz3 opened this issue · comments

Hi,

is there any plan in supporting multiple paths to be used for a directory index?
A use case is when you have multiple directories which are served under the same path by using serve-static like this:

app.use('/foo', serveStatic('public1'));
app.use('/foo', serveStatic('public2'));

app.use('/foo', serveIndex([ 'public1', 'public2' ]));

Is the idea of this feature for a request /foo/bar to list public1/bar and public2/bar in a single overlay?

Yes, exactly.

Gotcha. I actually have never considered it before, but it sounds slightly complex, but I'm not ruling it out yet.

I had a look into this and saw that the feature would require to change the parameters of the html method (at least the parameter types, because the file stat has to be done in multiple dirs).
The method gets exported, so I guess it's public API and this would be an incompatible change.
Another option would be to pass different parameters depending on multiple or single paths.

I would like to have your opinion on this before starting to code.

Hi @matz3 ! So as far as public API breakage, that is OK, so just work on that assumption. Once we have some PR, we can make a judgement of can it be made backwards-compatible or not and just live with that outcome :) This library is building up plenty of 2.0 things, so that would just nudge a 2.0 release (especially since Express 3.x is being discontinued, which is the only reason this module has been sticking to 1.x).

Thanks, so I'll go ahead 👍

Closing for now, as per #29 (comment)