docs
This commit is contained in:
53
README.md
53
README.md
@ -121,16 +121,17 @@ serving at http://localhost:8000
|
|||||||
|
|
||||||
[morgan](https://github.com/expressjs/morgan)
|
[morgan](https://github.com/expressjs/morgan)
|
||||||
|
|
||||||
### Mock Responses
|
|
||||||
*Coming soon*.
|
|
||||||
|
|
||||||
### Other features
|
### Other features
|
||||||
|
|
||||||
Compression, caching, simple statistics view, log, override mime types.
|
Serve gzip-compressed resources, where applicable
|
||||||
|
```sh
|
||||||
|
$ ws --compress
|
||||||
|
```
|
||||||
|
|
||||||
## Tips
|
Disable etag-based caching
|
||||||
|
```sh
|
||||||
### Use with Google DevTools Workspaces
|
$ ws --no-cache
|
||||||
|
```
|
||||||
|
|
||||||
### Log Visualisation
|
### 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).
|
Instructions for how to visualise log output using goaccess, logstalgia or gltail [here](https://github.com/75lb/local-web-server/wiki/Log-visualisation).
|
||||||
@ -180,42 +181,6 @@ $ npm start
|
|||||||
serving at http://localhost:8100
|
serving at http://localhost:8100
|
||||||
```
|
```
|
||||||
|
|
||||||
## Storing default options
|
|
||||||
To store per-project options, saving you the hassle of inputting them everytime, store them in the `local-web-server` property of your project's `package.json`:
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"name": "my-project",
|
|
||||||
"version": "0.11.8",
|
|
||||||
"local-web-server":{
|
|
||||||
"port": 8100
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
Or in a `.local-web-server.json` file stored in the directory you want to serve (typically the root folder of your site):
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"port": 8100,
|
|
||||||
"log-format": "tiny"
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
Or store global defaults in a `.local-web-server.json` file in your home directory.
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"port": 3000,
|
|
||||||
"refresh-rate": 1000
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
All stored defaults are overriden by options supplied at the command line.
|
|
||||||
|
|
||||||
To view your stored defaults, run:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
$ ws --config
|
|
||||||
```
|
|
||||||
|
|
||||||
## mime-types
|
## 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:
|
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:
|
||||||
|
|
||||||
@ -248,8 +213,6 @@ const localWebServer = require('local-web-server')
|
|||||||
localWebServer().listen(8000)
|
localWebServer().listen(8000)
|
||||||
```
|
```
|
||||||
|
|
||||||
## Composition
|
|
||||||
|
|
||||||
* * *
|
* * *
|
||||||
|
|
||||||
© 2015 Lloyd Brookes <75pound@gmail.com>. Documented by [jsdoc-to-markdown](https://github.com/jsdoc2md/jsdoc-to-markdown).
|
© 2015 Lloyd Brookes <75pound@gmail.com>. Documented by [jsdoc-to-markdown](https://github.com/jsdoc2md/jsdoc-to-markdown).
|
||||||
|
BIN
doc/img/logstagia.gif
Normal file
BIN
doc/img/logstagia.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 570 KiB |
37
doc/visualisation.md
Normal file
37
doc/visualisation.md
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
## Goaccess
|
||||||
|
|
||||||
|
## Logstalgia
|
||||||
|
local-web-server is compatible with [logstalgia](http://code.google.com/p/logstalgia/).
|
||||||
|
|
||||||
|
### Install Logstalgia
|
||||||
|
On MacOSX, install with [homebrew](http://brew.sh):
|
||||||
|
```sh
|
||||||
|
$ brew install logstalgia
|
||||||
|
```
|
||||||
|
|
||||||
|
Alternatively, [download a release for your system from github](https://github.com/acaudwell/Logstalgia/releases/latest).
|
||||||
|
|
||||||
|
Then pipe the `logstalgia` output format directly into logstalgia for real-time visualisation:
|
||||||
|
```sh
|
||||||
|
$ ws -f logstalgia | logstalgia -
|
||||||
|
```
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
## glTail
|
||||||
|
To use with [glTail](http://www.fudgie.org), write your log to disk using the "default" format:
|
||||||
|
```sh
|
||||||
|
$ ws -f default > web.log
|
||||||
|
```
|
||||||
|
|
||||||
|
Then specify this file in your glTail config:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
servers:
|
||||||
|
dev:
|
||||||
|
host: localhost
|
||||||
|
source: local
|
||||||
|
files: /Users/Lloyd/Documents/MySite/web.log
|
||||||
|
parser: apache
|
||||||
|
color: 0.2, 0.2, 1.0, 1.0
|
||||||
|
```
|
@ -121,16 +121,17 @@ serving at http://localhost:8000
|
|||||||
|
|
||||||
[morgan](https://github.com/expressjs/morgan)
|
[morgan](https://github.com/expressjs/morgan)
|
||||||
|
|
||||||
### Mock Responses
|
|
||||||
*Coming soon*.
|
|
||||||
|
|
||||||
### Other features
|
### Other features
|
||||||
|
|
||||||
Compression, caching, simple statistics view, log, override mime types.
|
Serve gzip-compressed resources, where applicable
|
||||||
|
```sh
|
||||||
|
$ ws --compress
|
||||||
|
```
|
||||||
|
|
||||||
## Tips
|
Disable etag-based caching
|
||||||
|
```sh
|
||||||
### Use with Google DevTools Workspaces
|
$ ws --no-cache
|
||||||
|
```
|
||||||
|
|
||||||
### Log Visualisation
|
### 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).
|
Instructions for how to visualise log output using goaccess, logstalgia or gltail [here](https://github.com/75lb/local-web-server/wiki/Log-visualisation).
|
||||||
@ -180,42 +181,6 @@ $ npm start
|
|||||||
serving at http://localhost:8100
|
serving at http://localhost:8100
|
||||||
```
|
```
|
||||||
|
|
||||||
## Storing default options
|
|
||||||
To store per-project options, saving you the hassle of inputting them everytime, store them in the `local-web-server` property of your project's `package.json`:
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"name": "my-project",
|
|
||||||
"version": "0.11.8",
|
|
||||||
"local-web-server":{
|
|
||||||
"port": 8100
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
Or in a `.local-web-server.json` file stored in the directory you want to serve (typically the root folder of your site):
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"port": 8100,
|
|
||||||
"log-format": "tiny"
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
Or store global defaults in a `.local-web-server.json` file in your home directory.
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"port": 3000,
|
|
||||||
"refresh-rate": 1000
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
All stored defaults are overriden by options supplied at the command line.
|
|
||||||
|
|
||||||
To view your stored defaults, run:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
$ ws --config
|
|
||||||
```
|
|
||||||
|
|
||||||
## mime-types
|
## 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:
|
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:
|
||||||
|
|
||||||
@ -231,8 +196,6 @@ You can set additional mime-type/extension mappings, or override the defaults by
|
|||||||
|
|
||||||
{{>main}}
|
{{>main}}
|
||||||
|
|
||||||
## Composition
|
|
||||||
|
|
||||||
* * *
|
* * *
|
||||||
|
|
||||||
© 2015 Lloyd Brookes <75pound@gmail.com>. Documented by [jsdoc-to-markdown](https://github.com/jsdoc2md/jsdoc-to-markdown).
|
© 2015 Lloyd Brookes <75pound@gmail.com>. Documented by [jsdoc-to-markdown](https://github.com/jsdoc2md/jsdoc-to-markdown).
|
||||||
|
Reference in New Issue
Block a user