zhanbei / static-server

A static server in Go, supporting hosting static files in the no-trailing-slash version.
0 stars 0 forks source link

Static Server

A static server in Go, supporting hosting static files in the no-trailing-slash version.

Installation

Get and install the repository using go get.

go get -u -v github.com/zhanbei/static-server

Applications

There are multiple entrances for several standalone applications, lightweight and special-purposed, or heavy and powerful.

  1. A/The Simple Static Site Server static-server assss zss
  2. Lightweight VHSS vhssl
  3. VHSS with MongoDB Driver vhssdb
    • Load configures and combine with interfaces.

Configures and Options

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.

Libraries to receive arguments and options.

  1. Command-line Arguments
  2. Configuration File

Examples of Usage

# 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