A static server in Go, supporting hosting static files in the no-trailing-slash version.
Get and install the repository using go get
.
go get -u -v github.com/zhanbei/static-server
There are multiple entrances for several standalone applications, lightweight and special-purposed, or heavy and powerful.
static-server
assss
zss
vhssl
vhssdb
Support multiple targets(file/stdout/files/mongodb) in multiple(possible) formats(text(common/combined/extended)/json/custom).
Formats\Targets | Stdout | File(s) | MongoDB |
---|---|---|---|
Text | +++ |
++ |
--- |
JSON | + |
+++ |
--- |
BSON | --- |
--- |
+++ |
Tools to convert between BSON
, JSON
, and Text
may be needed.
false
false
false
index.html
is not found when in the normal mode.true
X-Remote-Addr
> X-Forwarded-For
> IP
] over ctx.Request.Ip
.false
"text" | "json"
false
"stdout" | ${file}
${dir}
"stdout"|${file}
if the perHost
option is false.${dir}
if the perHost
option is true.false
"mongodb://${hostname}:${port=27017}"
string
"logging.vhss"
Libraries to receive arguments and options.
# Serving the current folder on a specific port.
static-server 1234
# Serving a specific folder on a specific port.
static-server 1234 ./some-folder/site-root
# Serving a folder in the no-trailing-slash mode.
static-server --no-trailing-slash 1234 ./some-folder/site-root
# Serving a folder in the no-trailing-slash mode with virtual hosting.
static-server --no-trailing-slash --enable-virtual-hosting 1234 ./some-folder/site-root
Run static-server --help
to get the help text, like shown below:
NAME:
static-server - A static server in Go, supporting hosting static files in the no-trailing-slash version.
USAGE:
static-server [global options] [<http-address>:]<http-port> <www-root-directory>
VERSION:
0.9.0
DESCRIPTION:
A static server in Go, supporting hosting static files in the no-trailing-slash version.
COMMANDS:
help, h Shows a list of commands or help for one command
GLOBAL OPTIONS:
--enable-virtual-hosting Whether to enable virtual hosting; @see https://en.wikipedia.org/wiki/Virtual_hosting
--no-trailing-slash Hosting static files in the no-trailing-slash mode.
--help, -h show help
--version, -v print the version