0.0.12 • Published 8 years ago
doc-server v0.0.12
doc-server
a simple and friendly static-file server, with live reload and markdown support for node
doc-server was inspired by some of the other static-file serving modules out there, such as node-static and md-server.
Install
$ npm install doc-server -g
Usage
$ doc-server
Options
usage: doc-server [OPTIONS] [directory]
Options:
Server Options:
-p INT, --port=INT TCP port at which the files will be served. (Default: 8080)
-a 127.0.0.1, --host-addresss=127.0.0.1
Begin accepting connections on the specified host. If the host is omitted, the server will accept connections directed to any IPv4 address. (Default: omitted)
-l, --no-log Disable logging requests and file reloads in console. (Default: enable)
-t TYPE, --log-type=TYPE Log format. Possible values are "combined", "common", "dev", "short" or "tiny". (Default: dev)
-q, --log-request Log request data. (Default: disabled)
-e, --no-respond-error Disable respond error and stack-trace back to requester. (Default: enable)
-r INT, --reload-delay=INT Interval in ms, which the server monitors the file system and reload webpage. (Default: 100)
-d, --no-parser-md Disable markdown parser. (Default: Enabled)
-y TYPE, --md-type=TYPE Markdown handler to use. Possible value are "mdwiki" and "marked". (Default: mdwiki)
-c, --no-livereload Disable live reload. (Default: Enabled)
-m INT, --max-age=INT Set the max-age property of the Cache-Control header in milliseconds or a string in ms format. (Default: 0)
--headers-file=headers.json JSON file of additional headers.
-g, --no-compress Disable compression. (Default: enable)
Authentication:
-u user, --username=user Username to authenticate.
-w pass, --password=pass Password to authenticate.
Static Options:
--static-dotFile=ARG Option for serving dotfiles. Possible values are “allow”, “deny”, and “ignore”. (Default: ignore)
--static-no-etag Disable etag generation. (Default: enable)
--static-extension=.ext Sets file extension fallbacks. Repeat --static-extension for each extension. (Default: empty)
--static-no-indexing Disable directory indexing. (Default: enable)
-i file.ext, --static-index=file.extIf directory indexing, sends directory index file. Repeat --static-extension for each extension. (Default: index.html, index.htm, index.md)
--static-no-last-modified Desable the Last-Modified header to the last modified date of the file on the OS. (Default: enable)
--static-no-redirect Disable redirect to trailing “/” when the pathname is a directory. (Default: enable)
Live Reload Options:
--lr-no-css Disable LiveReload live CSS reloading (Default: enable)
--lr-no-js Disable LiveReload live JS reloading (Default: enable)
--lr-no-img Disable LiveReload live IMG reloading (Default: enable)
--lr-ignore=.ext Sets file extension to ignore. Repeat --lr-ignore for each extension.
--lr-include=.ext Sets file extension to include. Repeat --lr-include for each extension.
MD Wiki Options: (see http://mdwiki.info for details):
Marked Options:
--md-no-gfm Disable GitHub flavored markdown. (Default: enable)
--md-no-table Disable GFM tables. This option requires the gfm option to be true. (Default: enable)
--md-breaks Enable GFM line breaks. This option requires the gfm option to be true. (Default: disable)
--md-pedantic Conform to obscure parts of markdown.pl as much as possible. Don\'t fix any of the original markdown bugs or poor behavior. (Default: disable)
--md-sanitize Sanitize the output. Ignore any HTML that has been input. (Default: disable)
--md-no-smartlists Disable the smarter list behavior than the original markdown. May eventually be default with the old behavior moved into pedantic. (Default: enable)
--md-smartypants Use "smart" typograhic punctuation for things like quotes and dashes. (Default: disable)
General Options:
-v, --version doc-server version.
-h, --help Print this help and exit.
URL Integration:
Use ?relatedTo=<file> in <a href=\'<URL>\'> to tell what monitored file will update the URL path. (Example: http://127.0.0.1/index.md?relatedTo=user.md which will tell to update the index.md if user.md is modified).
Use ?noParserMD in URL to disable markdown parse. (Example: http://127.0.0.1/index.md?noParserMD).
Examples
# serve up the current directory
$ doc-server
doc-server serving '.' http://any:8080
# serve up a different directory, port and host
$ doc-server test -p 8082 -a 172.31.24.40
doc-server serving 'test' http://172.31.24.40:8082
# specify additional headers (this one is useful for development)
$ echo '{ "custom": "header", "anothercustom": "header" }' > headers.json
$ doc-server --headers-file=headers.json
doc-server serving '.' http://any:8080
# set cache control max age (7 seconds)
$ doc-server -m 7200
doc-server serving '.' http://any:8080
# specify ignored files (pdf and swf)
$ doc-server --lr-ignore=.pdf --lr-ignore=.swf
doc-server serving '.' http://any:8080
# show help message, including all options
$ doc-server -h
Contribution and License Agreement
If you contribute code to this project, you are implicitly allowing your code to be distributed under the MIT license. You are also implicitly verifying that all code is your original work.
License
Copyright (c) 2015-2015, Conrado Quilles Gomes. (MIT License)
See LICENSE for more info.