docs
This commit is contained in:
21
LICENSE
Normal file
21
LICENSE
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2015 Lloyd Brookes <75pound@gmail.com>
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
24
README.md
24
README.md
@ -3,20 +3,20 @@
|
|||||||
[](https://david-dm.org/75lb/local-web-server)
|
[](https://david-dm.org/75lb/local-web-server)
|
||||||

|

|
||||||
|
|
||||||
#local-web-server
|
# local-web-server
|
||||||
Fires up a simple, CORS-enabled, static web server on a given port. Use for local web development or file sharing (directory browsing enabled).
|
Fires up a simple, CORS-enabled, static web server on a given port. Use for local web development or file sharing (directory browsing enabled).
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
##Install
|
## Install
|
||||||
Ensure [node.js](http://nodejs.org) is installed first. Linux/Mac users may need to run the following commands with `sudo`.
|
Ensure [node.js](http://nodejs.org) is installed first. Linux/Mac users may need to run the following commands with `sudo`.
|
||||||
|
|
||||||
###Globally
|
### Globally
|
||||||
```sh
|
```sh
|
||||||
$ npm install -g local-web-server
|
$ npm install -g local-web-server
|
||||||
```
|
```
|
||||||
|
|
||||||
###Bundled with your project
|
### Bundled with your project
|
||||||
```sh
|
```sh
|
||||||
$ npm install local-web-server --save-dev
|
$ npm install local-web-server --save-dev
|
||||||
```
|
```
|
||||||
@ -45,7 +45,7 @@ $ npm install
|
|||||||
$ npm start
|
$ npm start
|
||||||
```
|
```
|
||||||
|
|
||||||
##Usage
|
## Usage
|
||||||
```
|
```
|
||||||
Usage
|
Usage
|
||||||
$ ws <server options>
|
$ ws <server options>
|
||||||
@ -90,7 +90,7 @@ To add compression, reducing bandwidth, increasing page load time (by 10-15% on
|
|||||||
$ ws --compress
|
$ ws --compress
|
||||||
```
|
```
|
||||||
|
|
||||||
###Logging
|
### Logging
|
||||||
Passing a value to `--log-format` will write an access log to `stdout`.
|
Passing a value to `--log-format` will write an access log to `stdout`.
|
||||||
|
|
||||||
Either use a built-in [morgan](https://github.com/expressjs/morgan) logger preset:
|
Either use a built-in [morgan](https://github.com/expressjs/morgan) logger preset:
|
||||||
@ -108,7 +108,7 @@ Or silence:
|
|||||||
$ ws -f none
|
$ ws -f none
|
||||||
```
|
```
|
||||||
|
|
||||||
##Storing default options
|
## 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`:
|
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
|
```json
|
||||||
{
|
{
|
||||||
@ -144,7 +144,7 @@ To view your stored defaults, run:
|
|||||||
$ ws --config
|
$ 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:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
@ -155,10 +155,10 @@ You can set additional mime-type/extension mappings, or override the defaults by
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
##Use with Logstalgia
|
## Use with Logstalgia
|
||||||
local-web-server is compatible with [logstalgia](http://code.google.com/p/logstalgia/).
|
local-web-server is compatible with [logstalgia](http://code.google.com/p/logstalgia/).
|
||||||
|
|
||||||
###Install Logstalgia
|
### Install Logstalgia
|
||||||
On MacOSX, install with [homebrew](http://brew.sh):
|
On MacOSX, install with [homebrew](http://brew.sh):
|
||||||
```sh
|
```sh
|
||||||
$ brew install logstalgia
|
$ brew install logstalgia
|
||||||
@ -173,7 +173,7 @@ $ ws -f logstalgia | logstalgia -
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
##Use with glTail
|
## Use with glTail
|
||||||
To use with [glTail](http://www.fudgie.org), write your log to disk using the "default" format:
|
To use with [glTail](http://www.fudgie.org), write your log to disk using the "default" format:
|
||||||
```sh
|
```sh
|
||||||
$ ws -f default > web.log
|
$ ws -f default > web.log
|
||||||
@ -190,3 +190,5 @@ servers:
|
|||||||
parser: apache
|
parser: apache
|
||||||
color: 0.2, 0.2, 1.0, 1.0
|
color: 0.2, 0.2, 1.0, 1.0
|
||||||
```
|
```
|
||||||
|
|
||||||
|
© 2015 Lloyd Brookes <75pound@gmail.com>
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
"bin": {
|
"bin": {
|
||||||
"ws": "./bin/ws.js"
|
"ws": "./bin/ws.js"
|
||||||
},
|
},
|
||||||
|
"license": "MIT",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=0.10.0"
|
"node": ">=0.10.0"
|
||||||
},
|
},
|
||||||
|
Reference in New Issue
Block a user