From 77f87824788c8aabda2f95a1c0a8da998e0e187e Mon Sep 17 00:00:00 2001 From: Lloyd Brookes Date: Tue, 17 Nov 2015 14:02:23 +0000 Subject: [PATCH] docs --- README.md | 41 +++++++++++++++++++++++++---------------- doc/visualisation.md | 2 +- jsdoc2md/README.hbs | 41 +++++++++++++++++++++++++---------------- 3 files changed, 51 insertions(+), 33 deletions(-) diff --git a/README.md b/README.md index 96047ec..a80f509 100644 --- a/README.md +++ b/README.md @@ -88,7 +88,7 @@ $ ws --rewrite '/projects/:user/repos/:name -> https://api.github.com/repos/:use ### Stored config -Always use this port and blacklist? Persist it to `package.json`: +Use the same port and blacklist every time? Persist it to `package.json`: ```json { "name": "example", @@ -108,7 +108,12 @@ Always use this port and blacklist? Persist it to `package.json`: } ``` +local-web-server will merge and use all config found, searching from the current directory upward. In the case both `package.json` and `.local-web-server.json` config is found in the same directory, `.local-web-server.json` will take precedence. Command-line options take precedence over all. +To inspect stored config, run: +```sh +$ ws --config +``` ### Logging By default, local-web-server outputs a simple, dynamic statistics view. To see traditional web server logs, use `--log-format`: @@ -119,22 +124,37 @@ serving at http://localhost:8000 ::1 - - [16/Nov/2015:11:16:52 +0000] "GET / HTTP/1.1" 200 12290 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2562.0 Safari/537.36" ``` -[morgan](https://github.com/expressjs/morgan) +The format value supplied is passed directly to [morgan](https://github.com/expressjs/morgan). The exception is `--log-format none` which disables all output. + +### Other usage -### Other features +#### Compression Serve gzip-compressed resources, where applicable ```sh $ ws --compress ``` +#### Disable caching + Disable etag-based caching ```sh $ ws --no-cache ``` -### Log Visualisation -Instructions for how to visualise log output using goaccess, logstalgia or gltail [here](https://github.com/75lb/local-web-server/wiki/Log-visualisation). +#### mime-types +You can set additional mime-type/extension mappings, or override the defaults by setting a `mime` value in the stored config. This value is passed directly to [mime.define()](https://github.com/broofa/node-mime#mimedefine). Example: + +```json +{ + "mime": { + "text/plain": [ "php", "pl" ] + } +} +``` + +#### Log Visualisation +Instructions for how to visualise log output using goaccess, logstalgia or gltail [here](https://github.com/75lb/local-web-server/blob/master/doc/visualisation.md). ## Install Ensure [node.js](http://nodejs.org) is installed first. Linux/Mac users may need to run the following commands with `sudo`. @@ -181,17 +201,6 @@ $ npm start serving at http://localhost:8100 ``` -## mime-types -You can set additional mime-type/extension mappings, or override the defaults by setting a `mime` value in your local config. This value is passed directly to [mime.define()](https://github.com/broofa/node-mime#mimedefine). Example: - -```json -{ - "mime": { - "text/plain": [ "php", "pl" ] - } -} -``` - ## API Reference diff --git a/doc/visualisation.md b/doc/visualisation.md index da50129..76078ad 100644 --- a/doc/visualisation.md +++ b/doc/visualisation.md @@ -16,7 +16,7 @@ Then pipe the `logstalgia` output format directly into logstalgia for real-time $ ws -f logstalgia | logstalgia - ``` -![local-web-server with logstalgia](http://75lb.github.io/local-web-server/logstagia.gif) +![local-web-server with logstalgia](https://raw.githubusercontent.com/75lb/local-web-server/master/doc/img/logstagia.gif) ## glTail To use with [glTail](http://www.fudgie.org), write your log to disk using the "default" format: diff --git a/jsdoc2md/README.hbs b/jsdoc2md/README.hbs index 525ec64..951250a 100644 --- a/jsdoc2md/README.hbs +++ b/jsdoc2md/README.hbs @@ -88,7 +88,7 @@ $ ws --rewrite '/projects/:user/repos/:name -> https://api.github.com/repos/:use ### Stored config -Always use this port and blacklist? Persist it to `package.json`: +Use the same port and blacklist every time? Persist it to `package.json`: ```json { "name": "example", @@ -108,7 +108,12 @@ Always use this port and blacklist? Persist it to `package.json`: } ``` +local-web-server will merge and use all config found, searching from the current directory upward. In the case both `package.json` and `.local-web-server.json` config is found in the same directory, `.local-web-server.json` will take precedence. Command-line options take precedence over all. +To inspect stored config, run: +```sh +$ ws --config +``` ### Logging By default, local-web-server outputs a simple, dynamic statistics view. To see traditional web server logs, use `--log-format`: @@ -119,22 +124,37 @@ serving at http://localhost:8000 ::1 - - [16/Nov/2015:11:16:52 +0000] "GET / HTTP/1.1" 200 12290 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2562.0 Safari/537.36" ``` -[morgan](https://github.com/expressjs/morgan) +The format value supplied is passed directly to [morgan](https://github.com/expressjs/morgan). The exception is `--log-format none` which disables all output. + +### Other usage -### Other features +#### Compression Serve gzip-compressed resources, where applicable ```sh $ ws --compress ``` +#### Disable caching + Disable etag-based caching ```sh $ ws --no-cache ``` -### Log Visualisation -Instructions for how to visualise log output using goaccess, logstalgia or gltail [here](https://github.com/75lb/local-web-server/wiki/Log-visualisation). +#### mime-types +You can set additional mime-type/extension mappings, or override the defaults by setting a `mime` value in the stored config. This value is passed directly to [mime.define()](https://github.com/broofa/node-mime#mimedefine). Example: + +```json +{ + "mime": { + "text/plain": [ "php", "pl" ] + } +} +``` + +#### Log Visualisation +Instructions for how to visualise log output using goaccess, logstalgia or gltail [here](https://github.com/75lb/local-web-server/blob/master/doc/visualisation.md). ## Install Ensure [node.js](http://nodejs.org) is installed first. Linux/Mac users may need to run the following commands with `sudo`. @@ -181,17 +201,6 @@ $ npm start serving at http://localhost:8100 ``` -## mime-types -You can set additional mime-type/extension mappings, or override the defaults by setting a `mime` value in your local config. This value is passed directly to [mime.define()](https://github.com/broofa/node-mime#mimedefine). Example: - -```json -{ - "mime": { - "text/plain": [ "php", "pl" ] - } -} -``` - ## API Reference {{>main}}