https://github.com/fgeller/serve
Tiny app to serve current directory via HTTP
https://github.com/fgeller/serve
Last synced: about 1 year ago
JSON representation
Tiny app to serve current directory via HTTP
- Host: GitHub
- URL: https://github.com/fgeller/serve
- Owner: fgeller
- Created: 2015-10-25T20:30:16.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2020-12-15T12:03:48.000Z (over 5 years ago)
- Last Synced: 2024-06-20T15:41:24.129Z (about 2 years ago)
- Language: Go
- Size: 3.91 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# serve
Tiny app to serve the current directory via HTTP. Attempts to open the default browser
at the served location for Linux, OSX and Windows.
Install via
go get github.com/fgeller/serve
Make sure `$GOPATH/bin` is part of your `$PATH`.
Or grab a pre-built binary from the [release section](https://github.com/fgeller/serve/releases) and place it in a location on your `$PATH`.
Simply start via `serve` which will choose a random port:
$ serve
2015/10/26 09:26:05 Serving at http://0.0.0.0:60794.
2015/10/26 09:26:05 Opening...
Or specify a port:
$ serve 3022
2015/10/26 09:43:36 Serving at http://0.0.0.0:3022
2015/10/26 09:43:36 Opening...
Very similar to Python's `SimpleHTTPServer` module, which I had wrapped in the
following bash function:
function serve {
python -m SimpleHTTPServer "$@"
}
Turns out it's not straight-forward to detect the port on which the server is
listening, so I couldn't simply add a step to open my browser at a newly served
location.