http_server_cli

http_server_cli is a simple, zero-configuration command-line http server. It is highly inspired by node js http-server. Internally it uses dart http_server

Installation

If you want to use http_server_cli on the command line, install it using pub global activate:

pub global activate http_server_cli

How to run

pub run http_server_cli

Extra options

pub run http_server_cli --port 9000 --path ./test/public --not-found index.html --no-dir -s

Available Options/Flags:

-p or --port Port to use (defaults to 8080) -N or --not-found Page Not Found to use (defaults to '404.html') -a Address to use (defaults to 0.0.0.0)

-d Show directory listings (defaults to true), --no-dir for false

-i Display autoIndex (defaults to true) --no-index for false

-s or --silent Suppress log messages from output(defaults to false)

-h or --help Print this list and exit.

Features Coming soon

--cors Enable CORS via the Access-Control-Allow-Origin header

-o [path] Open browser window after starting the server. Optionally provide a URL path to open. e.g.: -o /other/dir/

-c Set cache time (in seconds) for cache-control max-age header, e.g. -c10 for 10 seconds (defaults to 3600). To disable caching, use -c-1.

-U or --utc Use UTC time format in log messages.

--log-ip Enable logging of the client's IP address (default: false).

-P or --proxy Proxies all requests which can't be resolved locally to the given url. e.g.: -P http://someurl.com

--username Username for basic authentication none

--password Password for basic authentication none

-S or --ssl Enable https.

-C or --cert Path to ssl cert file (default: cert.pem).

-K or --key Path to ssl key file (default: key.pem).

-r or --robots Provide a /robots.txt (whose content defaults to User-agent: *\nDisallow: /)

Libraries

server
util