http-server icon indicating copy to clipboard operation
http-server copied to clipboard

Add baseDir option, add -b flag to cli options to specify base path

Open jesseditson opened this issue 8 years ago • 20 comments

node-ecstatic allows for a baseDir option, which I was looking to use with this lib. This PR adds the following:

  • a baseDir option to the main lib file
  • a -b flag to the cli tool
  • a path variable to printed/opened URLs
  • CLI and README docs for baseDir and flag
  • tests for new baseDir option

Fixes #139

jesseditson avatar Jul 19 '16 02:07 jesseditson

+1, would this feature be merged?

miguelrincon avatar Feb 03 '17 15:02 miguelrincon

+1 Looking for this feature as well.

wootsaejao avatar Jun 01 '17 06:06 wootsaejao

Rebased in case this becomes mergeable - @indexzero LMK if I should keep this branch in sync or if we should close this PR, thanks!

jesseditson avatar Jun 01 '17 06:06 jesseditson

This is the same as #395 - hope the feature is available soon.

hikumealan avatar Nov 15 '17 04:11 hikumealan

+1

kolisko avatar Jun 22 '18 06:06 kolisko

This needs rebasing on top of the latest from master, but I generally prefer it (because tests, etc) to what's in #395.

If someone wants to get this up to speed with the latest from master, I'm 👍 on merging it.

BigBlueHat avatar Jun 22 '18 14:06 BigBlueHat

All set. Noticed the paths weren't printing to the logs, so I added that too.

jesseditson avatar Jun 22 '18 22:06 jesseditson

Hrm... -b conflicts with #463. @thornjad we should be careful about our shorthand choices probably... #395 also used -b. Thinking baseDir setting will be more frequently used, so maybe we use -b here, and remove the alias from #463.

BigBlueHat avatar Nov 14 '18 15:11 BigBlueHat

@BigBlueHat yeah that makes sense, 'b' is a popular letter. Brotli can be --brotli only

thornjad avatar Nov 14 '18 15:11 thornjad

Alright, @idmontie's #395 and @jesseditson's #294 have a one-line difference. I'm going to go with #294 because it came first

thornjad avatar Apr 22 '19 16:04 thornjad

I'll fix this up tonight (PST) and rebase against master!

jesseditson avatar Apr 22 '19 18:04 jesseditson

Ok I think this is up to date, LMK if there's anything else needed on my end!

jesseditson avatar Apr 23 '19 03:04 jesseditson

Would it be possible to split the change into

  1. introduce feature and --base-dir flag in a 12.x minor version
  2. default -b from --brotli to --base-dir in 13.x

The implementation seams ready and the functionality is requested ( see #139 ) since years. My use case is SPA with client side routing in 404.html on github pages. It would love to clean up my code ( dev mode work around ) as soon as this is available.

culmat avatar Feb 02 '20 09:02 culmat

Is this PR going to be merged any time soon? Would love to be able to use this functionality.

bishtawi avatar Jun 12 '20 19:06 bishtawi

Oh, please, is there any way one can help to get this merged?

cattermo avatar Jun 02 '21 12:06 cattermo

Requirements for merging:

  • [ ] Add documentation to doc/http-server.1
  • [x] Wait for #693 to merge (because it will likely cause conflicts)
  • [ ] Fix all conflicts

thornjad avatar Jul 12 '21 20:07 thornjad

This has long fallen off of my radar (I filed this PR 5 years ago and no longer have a dependency on this lib), happy to fix conflicts if a different interested party wants to get the docs going.

jesseditson avatar Aug 07 '21 18:08 jesseditson

Is this still an open feature?

I was trying to implement http-server with a base path but the -b flag is used for brotli now...

abbeysside avatar Dec 25 '21 23:12 abbeysside

@thornjad @jesseditson As this PR is 6 years old and (as one might expect) has gone stale, I rebased, fixed merge conflicts and made a new PR here: https://github.com/http-party/http-server/pull/837

MaximSagan avatar Oct 17 '22 03:10 MaximSagan

@thornjad @jesseditson As this PR is 6 years old and (as one might expect) has gone stale, I rebased, fixed merge conflicts and made a new PR here: #837

Can this be merged? We do need this feature. Thanks!

hairinwind avatar Dec 23 '22 01:12 hairinwind