refactor, readme
This commit is contained in:
15
README.md
15
README.md
@ -4,7 +4,9 @@
|
|||||||
|
|
||||||
local-web-server
|
local-web-server
|
||||||
================
|
================
|
||||||
Fires up a simple, static web server on a given port. Use for local web development or file sharing (directory browsing enabled).
|
Fires up a simple, static web server on a given port. A pure Javascript (and more reliable) alternative to `$ python -mSimpleHTTPServer 8000`.
|
||||||
|
|
||||||
|
Use for local web development or file sharing (directory browsing enabled). Plays well with Google Chrome Workspaces.
|
||||||
|
|
||||||
Install
|
Install
|
||||||
-------
|
-------
|
||||||
@ -18,6 +20,10 @@ $ npm install -g local-web-server
|
|||||||
|
|
||||||
Usage
|
Usage
|
||||||
-----
|
-----
|
||||||
|
```
|
||||||
|
usage: ws [--directory|-d <directory>] [--port|-p <port>] [--log-format|-f dev|default|short|tiny]
|
||||||
|
```
|
||||||
|
|
||||||
From the folder you wish to serve, run:
|
From the folder you wish to serve, run:
|
||||||
```sh
|
```sh
|
||||||
$ ws
|
$ ws
|
||||||
@ -27,9 +33,10 @@ serving at http://localhost:8000
|
|||||||
If you wish to serve a different directory, run:
|
If you wish to serve a different directory, run:
|
||||||
```sh
|
```sh
|
||||||
$ ws -d ~/mysite/
|
$ ws -d ~/mysite/
|
||||||
|
serving ~/mysite at http://localhost:8000
|
||||||
```
|
```
|
||||||
|
|
||||||
If you wish to override the default port (8000), use `--port` or `-p`:
|
If you wish to override the default port (8000), use `--port` or `-p`:
|
||||||
```sh
|
```sh
|
||||||
$ ws --port 9000
|
$ ws --port 9000
|
||||||
serving at http://localhost:9000
|
serving at http://localhost:9000
|
||||||
@ -61,12 +68,12 @@ $ ws --log-format default | 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
|
||||||
```
|
```
|
||||||
|
|
||||||
Then specify this file in your glTail config:
|
Then specify this file in your glTail config:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
servers:
|
servers:
|
||||||
|
@ -10,6 +10,6 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"connect": "~2.12.0",
|
"connect": "~2.12.0",
|
||||||
"nature": "~0.3.0",
|
"nature": "~0.3.0",
|
||||||
"wodge": "~0.1.1"
|
"wodge": "~0.1.5"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
7
ws.js
7
ws.js
@ -1,6 +1,7 @@
|
|||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
var connect = require("connect"),
|
var connect = require("connect"),
|
||||||
http = require("http"),
|
http = require("http"),
|
||||||
|
util = require("util"),
|
||||||
Thing = require("nature").Thing,
|
Thing = require("nature").Thing,
|
||||||
wodge = require("wodge");
|
wodge = require("wodge");
|
||||||
|
|
||||||
@ -59,5 +60,9 @@ if (!options.valid){
|
|||||||
/*
|
/*
|
||||||
write to stderr so not to appear in logs piped to disk ($ ws > log.txt)
|
write to stderr so not to appear in logs piped to disk ($ ws > log.txt)
|
||||||
*/
|
*/
|
||||||
console.error("serving at http://localhost:" + options.port);
|
console.error(util.format(
|
||||||
|
"serving %sat %s",
|
||||||
|
options.directory === process.cwd() ? "" : wodge.underline(options.directory) + " ",
|
||||||
|
wodge.underline("http://localhost:" + options.port)
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user