refactor, readme
This commit is contained in:
		@ -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,6 +33,7 @@ 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`:
 | 
				
			||||||
 | 
				
			|||||||
@ -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