goserve
goserve
is a small utility to serve static HTML files in a directory to a given port.
It is intented for developer who wants a quick access to their code through browser. Especially so when their code are not using relative path in link / image / CSS what so ever. Just compile the binary and put it in your PATH
, then it is good to go.
The code is dead simple. I simply don't want to write it all the time. And I wish it might be of help to you, too.
Requirement
goserve
requires only the core go libraries. No need to go get
anything other than this.
Installation
If you have set GOPATH/bin
to your PATH
, you may install and use this by:
go get -u github.com/go-serve/goserve
Alternatively, you may compile and copy the binary to your directory in PATH
.
git clone https://github.com/go-serve/goserve.git
cd goserve
go build
cp goserve YOUR_DIR_IN_PATH/.
Usage
Just type this, a server will be serving the files in the current directory to default port 8080:
goserve
To specify the directory, you may add 1 directory path as the argument:
goserve ./data
You may specify the port with environment variable PORT
:
PORT=8123 goserve ./data
You may manually override the default or PORT
with -port
parameter:
goserve -port=8123 ./data
Author
This software is written by Koala Yeung (koalay at gmail.com).
Licence
This software is licenced under GPL v3. You may obtain a copy of the licence in the LICENSE
file in this repository.
Bug Report
You are always welcome to report issue here:
https://github.com/go-serve/goserve/issues