The -o option is really handy, but unless I'm missing something I can't ask for anything other than the root to be opened? It'd be handy if we could specific a relative path, e.g.
http-server -o /pages/index.html
Opens browser with http://localhost:8080/pages/index.html
This would be handy for me. Looks like pretty isolated changes.
I create a pull request #260 that allows for using both a relative path and still allow for using an absolute path in the same way as before.
I think its a none breaking change as paths starting with a '/' didnt do anything anyway and will still allow anybodies pre-existing scripts to run :) plus its handy to be able to use an absolute url at times as well.
The only stipulation is the relative path must start with a forward slash '/'.
Related to issue #197. PR #250 addresses this directly, and #234, #260 add work arounds. If they could be reviewed, that would be great :)
+1
I am unbale to open my index.html page using any of following commannd
-o index
-o index.html
-o 'index.html'
-o '/index.html'
Am i misisng on something..I npm installed http-server today itself so believe to have the above change. The browser for me still opens at localhost:8080
any updates on this issue?
Any news on this? Really seems like a useful feature to have!
I don't understand what the path part of -o [path] was supposed to do it if did not behave this way. At least _one_ of the four combinations above should be working. I find that (at least on my Linux installation) that it only launches the browser (at all) if I do not specify the path after -o at all.
Any progress on this issue? I'd love to specify a location and a file, or have the root location be implicit in the file, e.g.:
http-server site1 -o test1.html
or
http-server -o site1/test1.html
any news on this?=
Nothing opens for me at all with the -o flag.
There were a few PRs open to address this. It looks like https://github.com/indexzero/http-server/pull/250 was @thornjad chosen solution, and is waiting to be merged.
I'm having the same problem. The -o option doesn't do anything on Ubuntu 18.04.2 LTS.
This awesome project is lacking a pulse and this was the feature I needed the most.
I wanted to set the public http static folder to ./ then launch to ./example/index.html.
But... the problem with -o is that it only launches to the root of the path.
http-server ./ -o
npm install live-server
live-server ./ --open='./example/'
Docs: https://www.npmjs.com/package/live-server
So this feature was added in https://github.com/http-party/http-server/pull/250 but it's not in the latest release of the package.
BUG: https://github.com/http-party/http-server/pull/250#issuecomment-526567304
Most helpful comment
I don't understand what the
pathpart of-o [path]was supposed to do it if did not behave this way. At least _one_ of the four combinations above should be working. I find that (at least on my Linux installation) that it only launches the browser (at all) if I do not specify the path after-oat all.Any progress on this issue? I'd love to specify a location and a file, or have the root location be implicit in the file, e.g.:
http-server site1 -o test1.htmlor
http-server -o site1/test1.html