diff --git a/README.md b/README.md index a180da8..a21e8b9 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,9 @@ 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 ------- @@ -18,6 +20,10 @@ $ npm install -g local-web-server Usage ----- +``` +usage: ws [--directory|-d ] [--port|-p ] [--log-format|-f dev|default|short|tiny] +``` + From the folder you wish to serve, run: ```sh $ ws @@ -27,9 +33,10 @@ serving at http://localhost:8000 If you wish to serve a different directory, run: ```sh $ 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 $ ws --port 9000 serving at http://localhost:9000 @@ -61,12 +68,12 @@ $ ws --log-format default | logstalgia - 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 $ ws -f default > web.log ``` -Then specify this file in your glTail config: +Then specify this file in your glTail config: ```yaml servers: diff --git a/package.json b/package.json index 811779e..7e4e4d2 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,6 @@ "dependencies": { "connect": "~2.12.0", "nature": "~0.3.0", - "wodge": "~0.1.1" + "wodge": "~0.1.5" } } diff --git a/ws.js b/ws.js index 03ba74a..4a3f890 100755 --- a/ws.js +++ b/ws.js @@ -1,6 +1,7 @@ #!/usr/bin/env node var connect = require("connect"), http = require("http"), + util = require("util"), Thing = require("nature").Thing, 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) */ - 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) + )); }